Forum Moderators: not2easy

Message Too Old, No Replies

CSS not working

         

spacefight

12:57 pm on Oct 7, 2005 (gmt 0)



Hi all,

I've encountered a strange problem using css for a <div> tag to have it overflow: auto. The overflow: auto does not work like it should, the text is shown in its full length over the whole page, not only within the 200 pixels specified by the height: attribute.

However, if I remove the <!doctype..> line or if I add a <dummytag> before the doctype starts, it works.

Has anyone ever seen such an error? It occurs both in FF 1.0.7 and IE 6.

Cheers!

My html document looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>foo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div id="divname" style="overflow: auto; height: 100;">
foo barfoo barfoo barfoo barfoo barfoo barfoo barfoo

[ huge text snipped ]
</div>

</body></html>

dcrombie

1:15 pm on Oct 7, 2005 (gmt 0)



100 ... what? You need to define your units!

eg. px, em, %, ...

;)

spacefight

1:33 pm on Oct 7, 2005 (gmt 0)



so stupid. Thanks. Funny is, that it works without the doctype as I said :)

tedster

1:38 pm on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Lots of things seem to "work" without a doctype -- at least in some browsers -- and then break with a DTD. The presence of a full doctype puts the browser's rendering engine into Standards Mode rather than Quirks Mode. For anyone who needs more information, check these threads:

Standards vs. Quirks Mode - overview [webmasterworld.com]
The Box Models - standards vs quirks [webmasterworld.com]

muneepenee

1:40 pm on Oct 7, 2005 (gmt 0)



if yu dont giv yunit, IE giv yu px
other browsers ignore the number