I’ve a simple container with a child element . When I’m giving margin to the child element margin-top : 10px
, it’s pushing the parent element downwards rather than pushing the child . I don’t know why this is happening . Please help me to understand it
<html>
<body>
<div class="parent">
<div class="child">
Lorem ipsum was a great man.
</div>
</div>
</body>
</html>
<style>
.child{
margin-top: 10px;
border: 1px solid black;
}
.parent{
border: 1px dashed red;
}
</style>