Why we Show encoded ampersand on HTML pages
Why we use &
instead of &开发者_C百科
?
From HTML 4.0.1 Specification:
Authors should use
&
(ASCII decimal 38) instead of&
to avoid confusion with the beginning of a character reference (entity reference open delimiter). Authors should also use&
in attribute values since character references are allowed within CDATA attribute values.
Your question should be reversed!
You should always use &
, because that's the only way to create valid HTML.
Since the &
character is used for entities (such as &
or >
), it must be escaped in order to write a literal &.
精彩评论