+ 1

When I'm nesting a div inside another div and giving margin-top to inner div why upper division moves down too

<div class="container> <div class="child"> </div> </div> CSS .container{ height:200px Background:black} .child{ height:50px background:red margin-top:10px} While I'm applying margin to child container moves down too

9th Jun 2020, 9:18 AM
Shivam Rawal
3 ответов
+ 1
Reset all margin and padding to zero * { margin: 0; padding: 0; }
9th Jun 2020, 9:33 AM
Calviղ
Calviղ - avatar
0
Ty both for valuable answers
9th Jun 2020, 10:12 AM
Shivam Rawal