Should the spacing between parent and child containers belong to parent or child?

Posted by johntrepreneur on Stack Overflow See other posts from Stack Overflow or by johntrepreneur
Published on 2012-03-28T23:26:34Z Indexed on 2012/03/28 23:29 UTC
Read the original article Hit count: 220

Filed under:
|
|
|
|

I'm struggling to determine where in my CSS the padding/margins should go to keep seperation between parent and child containers. For example, if you have have a parent div with two nested children and you need to have even 10px spacing between the children and also have the children be spaced 10 px from the parent; then would you add padding to parent div {padding:10px} and then just add 10px of margin between the children? Or would you leave the parent at 0 padding and have the children define what seperation they need from each other and also their parents?

© Stack Overflow or respective owner

Related posts about html

Related posts about css