Re: [css-d] Vertical padding weirdness
G. Sørtun skrev: Benct Philip Jonsson wrote: So that's the margins of the h1 and the p interfering? Outside the boxes of the divs which contain them? I *really* don't understand how margins are calculated! You're encountering collapsing margins... http://www.w3.org/TR/CSS21/box.html#collapsing-margins ...and in your case it's easier to think about them as escaping vertical margins. The vertical margins on elements do indeed escape containers, but will stop escaping inside the first containing-box that has vertical paddings set on it - one of the W3C-standardized contain vertical margins solutions available to us. Which contain vertical margins solution that works best will always depend on the actual case, but vertical paddings on the innermost containing-box will always do the job. Will setting any small amount of padding on the innermost containing box do the trick, like 1px or even 0px as opposed to not declaring any padding at all? /BP Keep the above W3C link handy, study what it says, but don't worry too much about not understanding exactly how collapsing margins works in its minutest details. Those who write standards and build browsers have had their fair share of failures in writing and programming in and out around those collapsing margins over the years, and you may still run into some unclear and inconsistent cases in both camps. regards Georg __ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Vertical padding weirdness
Benct Philip Jonsson wrote: Will setting any small amount of padding on the innermost containing box do the trick, like 1px or even 0px as opposed to not declaring any padding at all? Has to result in a real vertical padding - minimum 1px - to work reliable, so 0px, or a value so small that it results in zero padding when various browsers calculate it, won't work. regards Georg __ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Re: [css-d] Vertical padding weirdness
Benct Philip Jonsson wrote: So that's the margins of the h1 and the p interfering? Outside the boxes of the divs which contain them? I *really* don't understand how margins are calculated! You're encountering collapsing margins... http://www.w3.org/TR/CSS21/box.html#collapsing-margins ...and in your case it's easier to think about them as escaping vertical margins. The vertical margins on elements do indeed escape containers, but will stop escaping inside the first containing-box that has vertical paddings set on it - one of the W3C-standardized contain vertical margins solutions available to us. Which contain vertical margins solution that works best will always depend on the actual case, but vertical paddings on the innermost containing-box will always do the job. Keep the above W3C link handy, study what it says, but don't worry too much about not understanding exactly how collapsing margins works in its minutest details. Those who write standards and build browsers have had their fair share of failures in writing and programming in and out around those collapsing margins over the years, and you may still run into some unclear and inconsistent cases in both camps. regards Georg __ css-discuss [cs...@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/