Forum Moderators: not2easy

Message Too Old, No Replies

Div heigth problem in IE

... or perhaps in me?

         

topsport

10:32 am on Oct 31, 2005 (gmt 0)

10+ Year Member



I have problems setting the height of a <div>. Everything looks OK in Firefox, but not in IE (I tested this with IE 6.0). For best descripton of the problem, please preview the code in Firefox and then in IE. In IE the heigth of the <div> should by " height:3px;", but it is not!

Here is my code:
<html><head>
<style>
div#item {
position:absolute;
height:3px;
width:3px;
background-color:#FF0000;}
</style>
</head>

<body>
<div id = "item" style="top:110px; left:100px;" ></div>
<div id = "item" style="top:120px; left:100px;" ></div>
<div id = "item" style="top:130px; left:100px;" ></div>
<div id = "item" style="top:110px; left:110px;" ></div>
<div id = "item" style="top:120px; left:110px;" ></div>
<div id = "item" style="top:130px; left:110px;" ></div>
<div id = "item" style="top:110px; left:120px;" ></div>
<div id = "item" style="top:120px; left:120px;" ></div>
<div id = "item" style="top:130px; left:120px;" ></div>
</body></html>

What am I missing?

gorghazaryan

11:49 am on Oct 31, 2005 (gmt 0)

10+ Year Member



hello

just add "overflow:hidden" in your div styles

good luck

Robin_reala

1:41 pm on Oct 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe IE is setting a default line-height for your <div>s and then expanding them to fit that. Try adding 'line-height: 3px' to your CSS as well.

topsport

2:29 pm on Oct 31, 2005 (gmt 0)

10+ Year Member



"overflow:hidden" fixed it!

10x!

Setek

3:30 am on Nov 2, 2005 (gmt 0)

10+ Year Member



This is completely off-topic, but an element ID should only appear once on a page...

If it needs to be repeated, use a class (.)

:)