Box Model Margins
I understand that if no padding or borders are set for an element then these attributes use a default value of zero, but what about margins? I know you can set them to auto so that a margin will be generated to fill any unused area inside the parent content "width", but what if margins are not specified?
will they also have a default value of zero, leading to the child elements whole element box width(margins+borders+padding+CONTENT) being made up of solely its CONTENT box.
I realize this is a newbie question and thank you all for your patience.
Note:Assume no padding in the parent.
Busy posted this at 21:29 — 9th May 2006.
He has: 6,151 posts
Joined: May 2001
I'm not sure of the CSS specs but know HTML there are default margins/padding etc and these differ between browsers, sometimes 0, sometimes 3, some 5px.
It all depends on what, where and how.
If your example is a list then there will be default spacings (padding/margins ...), but if just a nested div then probably not unless it includes a heading tag or similar that has spacing by default.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.