Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with DIV height... 1

Status
Not open for further replies.

rockyroad

Programmer
Feb 22, 2003
191
US
Why can't I control the height of this DIV?

<div id="HEADER" style="width: 100%; height:1px; background-color: #FF1300; display:block; padding:0; margin:0; position:absolute;"></div>

WhenI view in browser it always looks like it's 10px high, weird. But if I enter in a width of say 30px, sure enough it's 30 px high. What the heck is going on here?

[hairpull]

Thanks

RR
 
Add this to the STYLE attribute of the DIV tag:

font-size:0px

'not sure why I thought of it, but it seems the DIV is artificially expanded by the non-existant type it is prepared to hold. I've had this problem before, but couldn't find a solution. Now we both know!

--Dave
 
You could also add overflow:hidden:

Code:
<div id="HEADER" style="width:100%; height:1px; [b]overflow:hidden;[/b] background-color:#FF1300; display:block; padding:0; margin:0; position:absolute;"></div>

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Add this to the STYLE attribute of the DIV tag:

font-size:0px

Thanks for the tip! I was scratching my head over the same problem, and I am glad I found this posting. Btw, it only is a problem with explorer. Firefox and Opera seem to render it okay.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top