Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div height solution missing in ie6

Tags:

html

css

height

i'm using a empty div to display a line by setting height 3px. it works fine in all browsers but in ie6 the height div displayed with 20px height. It remains same even for height:0px . But changes in other properties reflects but not height and there is no duplicate css entry and inherited value from other div. Can any one help please

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

CSS:

#line {
    border: none;
    background-color: #134c7c;
    height: 3px;
    margin-bottom: 20px;
}
like image 232
ArK Avatar asked Dec 02 '22 07:12

ArK


2 Answers

Internet Explorer has the odd idea that the content of every element should be at least one character high. You can get around this by using the overflow attribute, that way the content can remain a character high, but it doesn't affect the height of the element itself:

.line { height: 3px; overflow: hidden; }
like image 116
Guffa Avatar answered Dec 27 '22 08:12

Guffa


Try:

line-height:0
like image 45
Roberto Aloi Avatar answered Dec 27 '22 10:12

Roberto Aloi