是否仍然需要在关闭XHTML中的空元素之前放置一个空格? [英] Is it still necessary to put a space before closing an empty element in XHTML?

查看:171
本文介绍了是否仍然需要在关闭XHTML中的空元素之前放置一个空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

W3C建议在XHTML中在结束标记前加一个空格,因为这个将给予一些更好的向后兼容性与一些浏览器,例如请写< br /> 而不是< br /> 。但是仍然有浏览器,那不会容忍你省略了空间? (W3C没有提到哪些浏览器会导致问题。)



我知道它不会产生太多的差异。我只是喜欢较短的版本。因此,除非有一个很好的理由,我现在开始编码我的XHTML没有空格,然后关闭空标签。

解决方案



我仍然包括它的习惯,我的模板库会把它们放在我身上,但今天是否真的很重要。

W3C recommends putting a space before the closing tag in XHTML, because this would give a better backwards compability with some browsers, e.g. write <br /> instead of <br/>. But are there still browsers out there, that would not tolerate that you omitted the space? (W3C do not mention which browsers cause problems.)

I know it doesn't make much of a diffence. I just prefer the shorter version. So unless there is a good reason I will now start coding my XHTML without spaces before closing empty tags.

解决方案

It's for Netscape 4.

I still include it out of habit, and my templating library will put them in for me anyway, but it's questionable whether it's really that important today.

这篇关于是否仍然需要在关闭XHTML中的空元素之前放置一个空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆