Do I `HAVE` to add a space inside an empty DIV tag?
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开发者_如何学C <div></div>
and this would be right <div> </div>
.
Question: Is he an idiot or does he know something?
Thank you.
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.
i usually add
instead of the empty space!
I would add a comment so that nothing is displayed. This does cause problems in ie8 for some reason!
精彩评论