等号“=”的 HTML 字符实体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1452653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
HTML character entity for equal character "="
提问by Jeremy Ruten
What is the character entity for the equal character in HTML? I have been looking and I cannot find the character entity reference for that one character.
HTML中相等字符的字符实体是什么?我一直在寻找,但找不到该角色的角色实体参考。
EDIT:
编辑:
I am building a JSLint style validator for HTML. I am not happy with current validators as they only validate syntax requirements and not best practice considerations. I am requiring that the equal character in attribute values be escaped to prevent confusion between a legal value that contains and equal character and two illegal attributes that are not separated by a space.
我正在为 HTML 构建一个 JSLint 样式验证器。我对当前的验证器不满意,因为它们只验证语法要求而不是最佳实践注意事项。我要求对属性值中的相等字符进行转义,以防止包含相等字符的合法值与两个未用空格分隔的非法属性混淆。
回答by Jeremy Ruten
I use asciitable.com. =
has ASCII value 61
, so the HTML entity is =
.
我使用asciitable.com。=
有 ASCII 值61
,所以 HTML 实体是=
.
回答by Joel Spolsky
You can use =
, but it's not really necessary to escape = in HTML.
您可以使用=
,但实际上没有必要在 HTML 中转义 =。
回答by laggingreflex
There's also this %3D
in percent-encoding.
%3D
在百分比编码中也有这个。
回答by Baptiste
The character entity for the equal character, working with most browsers, is =
.
This will not work with Safari version 3.
适用于大多数浏览器的相等字符的字符实体是=
. 这不适用于 Safari 版本 3。
Reference : https://code.google.com/p/doctype-mirror/wiki/EqualsCharacterEntity
参考:https: //code.google.com/p/doctype-mirror/wiki/EqualsCharacterEntity
=
is not supported in HTML4 standards : http://www.w3.org/TR/html4/sgml/entities.html=
is supported in HTML5 standards : http://dev.w3.org/html5/html-author/charref
=
HTML4 标准不支持:http: //www.w3.org/TR/html4/sgml/entities.html=
HTML5 标准支持:http: //dev.w3.org/html5/html-author/charref
For a better cross-browsers compatibility, you should use the =
entity.
If you want to be only-HTML5 compliant, I think the best is =
.
为了更好的跨浏览器兼容性,您应该使用=
实体。如果您只想与 HTML5 兼容,我认为最好的是=
.
回答by Bombe
=
=
But—why?
但为什么?
回答by akbiggs
=
If http://www.december.com/html/spec/codes.htmlis to believed, that is.