My Thoughts & Views

CSS Hacks: DIV Height Problem and Solution

Posted on: June 4, 2008

If you set height in css for a div and check it in IE and Firefox you will get two different heights.

Empty divs in IE have a minimum height, more or less equal to the current line-height.

The way to solve this is:

1) Put a comment inside the div: <div style=”height: 10px;”><!– –></div>
2) Put a inside the div and add this to its style: font-size:1px; line-height:0.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: