Forum Moderators: open

Message Too Old, No Replies

div height %

IE, doctype, div %

         

antidote

1:42 am on Jun 6, 2002 (gmt 0)

10+ Year Member



Here's something I recently came across and was baffled by:

div {
position: absolute;
height: 100%;
width: 20%;
background-color: red;
}

As far as I can tell sifting through the W3C the above is valid code. With doctype declared (any flavor) IE will display the division only as high as your text. On Mozilla it will display as 100% of the page as you'd expect even if the div is empty. However, when no doctype is declared - the doc just begins with <html> - the div's will display in IE as they do in Mozilla.

Has anyone else run into this? Is this an oversight on IE's part? Is this not valid?

papabaer

2:12 am on Jun 6, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello antidote,

IE offers the least support for CSS1 & CSS2 among the modern "Web Standard Browsers." IE depends on content to determine height and ignores the height% value. It will be quite awhile (unfortunately) before percentage heights will be practical for general use.

[w3.org...]

antidote

2:30 am on Jun 6, 2002 (gmt 0)

10+ Year Member



Thanks for your quick response papabaer! However, my point was that if you comment out the doctype declaration IE seems to render height %'s correctly.