> Top padding on the parent element ? > (border or padding are not 'crappy' solutions to the problem of > collapsing margins in my book.)
Well, the question was to fix this without touching the padding/margin method used. As I'm looking for a good way to work with margins and paddings I was trying out this solution. The reason why I dropped the top padding in the parent div was to have an easier IE6 stylesheet (no more need to single out the first child and drop its top-margin). Adding a border on the parent this is an ugly trick because when changing the background color you need to change the border color too. Generally I avoid such methods in css. > Or: establishing a new block-formatting context That's the overflow trick I've been using, I just wonder if there's a safe fix that will work seamlessly in all situation. I can add overflow:hidden but then I can't position anything outside my parent container anymore ... etc etc. Hope I made it a little clearer now what kind of fix I'm looking for. Greets, Niels Matthijs -----Original Message----- From: Philippe Wittenbergh [mailto:[EMAIL PROTECTED] Sent: woensdag 12 maart 2008 14:52 To: CSS-D Cc: Niels Matthijs Subject: Re: [css-d] margins & background clipping On Mar 11, 2008, at 8:27 PM, Niels Matthijs wrote: > This has to do with collapsing margins as giving the parent element > a border also helps. Sadly, these are crappy solutions, I just don’t > want my background clipped there. Any way to avoid/fix this without > touching the method of margins/paddings I’m using ? Top padding on the parent element ? (border or padding are not 'crappy' solutions to the problem of collapsing margins in my book.) Or: establishing a new block-formatting context (css2.1 : 9.4.1 -[1]), such as overflow other than visible, display table-cell, float, display:inline-block, ... Establishing that new block formatting context on the parent element will always contain the margins of the descendant. [1] http://www.w3.org/TR/CSS21/visuren.html#block-formatting Philippe --- Philippe Wittenbergh http://l-c-n.com/ No virus found in this incoming message. Checked by AVG. Version: 7.5.518 / Virus Database: 269.21.7/1325 - Release Date: 11/03/2008 13:41 No virus found in this outgoing message. Checked by AVG. Version: 7.5.518 / Virus Database: 269.21.7/1325 - Release Date: 11/03/2008 13:41 ______________________________________________________________________ css-discuss [EMAIL PROTECTED] 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/
