I have two div
elements and nav > nav_1
. When i add a margin-top:20px;
to nav
, nav
goes down 20px
according to body which is correct.
But when i add this margin-top:20px;
to nav_1
,nav_1
goes down 20px
with nav
according to body.
why ? nav_1
element of nav
and it should move according to nav
.
In that question im looking for an explanation
.nav {
height: 500px;
width: 500px;
background-color: black;
margin-top:50px;
}
.nav .nav_1 {
height: 50px;
width: 50px;
background-color: blue;
margin-top:50px;
}
<div class="nav">
<div class="nav_1">
</div>
</div>