Question

I was reading a book about AJAX and the writer said that one should always add a space inside of empty div tags so as to not risk compatibility problems in "some browsers".

So this would be wrong <div></div> and this would be right <div> </div>.

Question: Is he an idiot or does he know something?

Thank you.

Was it helpful?

Solution

He's not an idiot. IE 8 (possibly earlier versions as well?) will subtly mess up your layout if your empty div is really empty; adding a comment seems to be the suggested way of dealing with it, but apparently a space works as well.

OTHER TIPS

i usually add &nbsp; instead of the empty space!

I would add a comment so that nothing is displayed. This does cause problems in ie8 for some reason!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top