I always saw statements to not use &
in HTML documents by itself, and use &
instead.
So I tried putting &
in the title and in the content of the page, but they validate:
http://topics2look.com/code-examples/HTML/ampersand-by-itself-can-validate.html
Is &
by itself legal in HTML 4.01 Strict documents?
The W3C HTML 4.01 Strict Charset section says
Four character entity references deserve special mention since they are frequently used to escape special characters:
* "<" represents the < sign. * ">" represents the > sign. * "&" represents the & sign. * "" represents the " mark.
Authors wishing to put the "<" character in text should use "<" (ASCII decimal 60) to avoid possible confusion with the beginning of a tag (start tag open delimiter). Similarly, authors should use ">" (ASCII decimal 62) in text instead of ">" to avoid problems with older user agents that incorrectly perceive this as the end of a tag (tag close delimiter) when it appears in quoted attribute values.
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.
As it uses the word "should" instead of "must", I guess you can skip it and still validate.
But don't do that, because it will sometimes render oddly.
I actually had to escape a couple of the ampersands in my cut-paste of this quote to get SO to render the character entity text... ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With