开发者

Why we Show encoded ampersand on HTML pages

开发者 https://www.devze.com 2023-03-06 02:24 出处:网络
Why we use & instead of &开发者_C百科 ? What is the advantage ?From HTML 4.0.1 Specification:

Why we use & instead of &开发者_C百科 ?

What is the advantage ?


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 &.

0

精彩评论

暂无评论...
验证码 换一张
取 消