Are single quotes valid in HTML? And more specifically: XHTML strict.
单引号在HTML中有效吗?更具体地说:XHTML strict。
<table width="100%">
<table width='100%'>
21
Yes, single quotes are valid.
是的,单引号是有效的。
From the XML spec:
从XML规范:
[10] AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"
5
A source of confusion on this matter seems to come from this article,
关于这个问题的困惑似乎来自这篇文章,
http://www.javascriptkit.com/howto/xhtml_intro.shtml
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.
这似乎表明单引号在xhtml中无效。但是,由于没有引用任何规范,并且由于本文还声明,属性和元素的小写名称是被禁止的,因此作者可能只是表示了一种禁止使用单引号的编辑禁令。
4
According to the spec, both are valid :-)
根据规范,两者都是有效的:-)
[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'
| "'" ([^%&'] | PEReference | Reference)* "'"
[10] AttValue ::= '"' ([^<&"] | Reference)* '"'
| "'" ([^<&'] | Reference)* "'"
[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
And the W3C-Validator accepts it as well.
w3c验证器也接受它。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2010/02/05/2220d2b12df622213ba3f809b3e2f5c5.html。