When I'm nesting a div inside another div and giving margin-top to inner div why upper division moves down too | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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