I created a simplified menu bar with an additional widget box. Now I want to define a spacing between both of these classes using JavaScript. The distance between .menu
and .widget
has to be 100px
constantly.
How can I make this possible using JavaScript?
(I do not want to use attributes like padding, margin or top in CSS)
.menu {
background: black;
height: 50px;
width: 100%;
color:red;
}
.widget {
background: green;
height: 100px;
width: 100px;
border-radius: 5px;
}
<div class="menu">Menu Bar</div>
<div class="widget">Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text</div>