Interview Questions

I made a 10px-high div, but IE makes it 20px high...

CSS Interview Questions and Questions


(Continued from previous question...)

103. I made a 10px-high div, but IE makes it 20px high...

Yeah
This problem sometimes comes up when you make a div just to contain the bottom border of a box, or something like that. In this situation, there's no text in the div, but IE won't let the height of the div be smaller than the line-height (which usually depends on the font-size). The answer is to set the font-size to zero.
CSS
#thediv {
font-size:0;
}

(Continued on next question...)

Other Interview Questions