我是否“必须”在空 DIV 标签内添加空格?
我正在读一本关于 AJAX 的书,作者说应该始终在空 div 标签内添加一个空格,以免在“某些浏览器”中出现兼容性问题。
所以这将是错误的 而这将是正确的
。
问:他是个白痴还是知道什么?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
他不是白痴。如果你的空 div 确实是空的,IE 8(也可能是早期版本?)会巧妙地弄乱你的布局;添加评论似乎是建议的处理方法,但显然空格也可以。
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!
我会添加评论,以便不显示任何内容。由于某种原因,这确实会导致 ie8 出现问题!
I would add a comment so that nothing is displayed. This does cause problems in ie8 for some reason!