I have empty space div that goes like this:

<div id="space"><!-- IE fix--></div>

and the CSS for this is:

#space{font-size:0;
   background-color:transparent;
   height:15px;
   display:block;
}

This should just make an empty box. And its fine in firefox. But in IE I get no space at all! Whats wrong?

Recommended Answers

All 5 Replies

IE does not render "wasted" tags (tags without actual content).

Stick a br tag inside it.

Theres no reason to have an empty space div, just add a margin to the surrounding div

I am leaning toward cmills on this one. Why do you need an empty div?

If it is a must, you could also try throwing a transparent "spacer" gif in there.

I was going to agree with you, then I found this DIV tag in my own code which I forgot I used to adjust the position of the content below it. (It seemed to be the simplest solution at the time)

<div style="height: 37px;">&nbsp;</div>

Like I had mentioned before, &nbsp; works just fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.