Because neither <pre>
nor <code>
means "Don't treat this as markup."
<pre>
means "Play spaces here"
<code>
means "Imagine this (i.e. use a suitable font, etc.) in such a way that it informs the reader that it is sample code."
If you want to use characters that have special meaning in HTML (for example, <
), you still have to use objects to represent them.
<
for <
>
for >
&
for &
You do not need to worry about '
or "
since you are not inside the attribute value.
Quentin
source share