Click to See Complete Forum and Search --> : DIV Height


Dysan
01-16-2008, 07:26 PM
The following code displays a div. How do I get the div to display at 5px in height, in IE & FireFox?

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style>
body
{
FONT-SIZE: 8pt;
FONT-FAMILY: Verdana;
PADDING: 0px;
MARGIN: 0px;
}

#line
{
TOP: 100px;
LEFT: 100px;
WIDTH: 100px;
PADDING: 0px;
POSITION: absolute;
BORDER: 1px solid rgb(0,0,0);
}</style>
</head>

<body>
<div id="line"></div>
</div>
</body>
</html>

sneakyimp
01-17-2008, 05:51 PM
in your #line css add:

height: 5px;


it probably won't work in IE6 but should in IE7. It's important for you to realize that a single browser will render the same exact html differently depending on your DOCTYPE declaration. View source of this phpbuilder page and look at the top and you'll see this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Google 'doctype declaration' or 'quirks mode' for more information.