单引号在 HTML/XHTML 中有效吗?
单引号在 HTML 中有效吗?更具体地说:XHTML 严格。
<table width="100%">
<table width='100%'>
Are single quotes valid in HTML? And more specifically: XHTML strict.
<table width="100%">
<table width='100%'>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,单引号有效。
来自 XML 规范:
Yes, single quotes are valid.
From the XML spec:
关于这个问题的混乱来源似乎来自这篇文章,
http://www.javascriptkit.com /howto/xhtml_intro.shtml
似乎声称单引号在 xhtml 中无效。然而,由于没有引用任何规范,并且该文章还声称禁止使用小写的属性和元素名称,因此作者可能只是表达了反对使用单引号的编辑禁止。
A source of confusion on this matter seems to come from this article,
http://www.javascriptkit.com/howto/xhtml_intro.shtml
which seems to claim that single quotes are not valid in xhtml. However, since no specification is cited, and since the article also claims that lowercase names for attributes and elements are forbidden, the author may merely be expressing an editorial prohibition against using single quotes.
根据规范,两者都是有效的:-)
并且W3C验证器接受它也是如此。
According to the spec, both are valid :-)
And the W3C-Validator accepts it as well.