W3C home > Mailing lists > Public > www-style@w3.org > February 2007

Re: Float margin relativity (Was Re: Underhang protection)

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 28 Feb 2007 21:58:31 +0000 (UTC)
To: Daniel Beardsmore <public@telcontar.net>
Cc: www-style@w3.org
Message-ID: <Pine.LNX.4.62.0702282156530.26598@dhalsim.dreamhost.com>

On Wed, 28 Feb 2007, Daniel Beardsmore wrote:
> 
>   <div style="display: float; width: 10em; height: 6em; border: 2px solid
> black;
>   margin: 0.5em">Float</div>
> 
>   <blockquote>This is a quotation</blockquote>
> 
>   <p>Lorem ipsum dolor</p>
> 
> This will produce:
> 
> +------------------+ This is a quotation
> |Float             |
> |                  | Lorem ipsum dolor
> |                  |
> |                  |
> +------------------+
> 
> The blockquote normally has a left margin relative to its parent 
> container, but when it sits to the right of a float, it doesn't. I would 
> guess that there's a nasty hack somewhere for this, too, but IMO a left 
> margin on an element to the right of a float, should be obeyed.
> 
> Both padding-left and margin-left are relative to the container element 
> (here, assumably body) and are not influenced by floats. Thus, if you 
> place floats within text, any items such as blockquote and bulleted 
> lists will (with conventional default styling) get their left margins 
> "removed".

This is a known problem and CSS3 has had the proposed float-displace and 
intend-edge-reset properties to handle it since 2002 or so:

   http://www.w3.org/TR/css3-box/#the-float-displace

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 28 February 2007 21:58:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:49 GMT