:: a z y u r e . c o m ::

IE Bug – making a 0px high div

by azyure on Dec.03, 2009, under code bits, life's like this

I found that when I was creating div’s with ‘clear:both’ of different heights (which I use for spacing in my design)

.clear {clear: both; height: 0px; line-height: 0px; width:100%;}
.clear5 {clear: both; height: 5px; line-height: 5px; width:100%;}
.clear10 {clear: both; height: 10px; line-height: 10px; width:100%;}
.clear20 {clear: both; height: 20px; line-height: 20px; width:100%;}

Basically spanky IE makes your empty div the same height as your line height – so to fix this you need to specify line height ‘0px’ etc etc.

Bad bad IE


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...