我是否“必须”在空 DIV 标签内添加空格?

发布于 2024-09-26 21:17:55 字数 179 浏览 1 评论 0原文

我正在读一本关于 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

哆兒滾 2024-10-03 21:17:55

他不是白痴。如果你的空 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.

秋风の叶未落 2024-10-03 21:17:55

我通常添加   而不是空白!

i usually add   instead of the empty space!

往日情怀 2024-10-03 21:17:55

我会添加评论,以便不显示任何内容。由于某种原因,这确实会导致 ie8 出现问题!

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文