W3C home > Mailing lists > Public > www-style@w3.org > May 2004

Re: Percentage height meaurements.

From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
Date: Fri, 28 May 2004 11:42:31 +1000
Message-ID: <40B69907.3050006@iinet.net.au>
To: Richard York <richy@smilingsouls.net>
Cc: www-style@w3.org

Richard York wrote:
> Is that the consensus then? There is no way to 
> make the height truly fluid and have margins too?

   Yes, there is if you read my previous post [1].  Although, now that 
I've had time to test it, I've made a few minor corrections — Relative 
positioning doesn't work as I thought it would, and I forgot about the 
width shrink wrapping the content when position is absolute.

div {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;

      padding: 10px;
      margin: 10px;
      border: 1px solid black;
}

   This stretches the content to the full height and width of the 
containing block, without the margins overflowing.  It should work in 
any standards compliant UA; it definately works in Mozilla  1.6 (which 
is all I have available to test in right now)  You may be able to find 
some kind of hack to get it to work in all UAs, including IE, perhaps 
using nested divs, etc... but that's not appropriate discussion for this 
list.

[1] http://lists.w3.org/Archives/Public/www-style/2004May/0475.html

-- 
Lachlan Hunt

lachlan.hunt@lachy.id.au
http://www.lachy.id.au/
Received on Thursday, 27 May 2004 21:46:53 GMT

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