Sourav
Sourav

Reputation: 17530

Why we Show encoded ampersand on HTML pages

Why we use & instead of & ?
What is the advantage ?

Upvotes: 0

Views: 279

Answers (2)

evilone
evilone

Reputation: 22740

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!

Upvotes: 4

SLaks
SLaks

Reputation: 887767

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

Upvotes: 4

Related Questions