[ACCEPTED]-How do I display HTML code (entities) on a web page?-html

Accepted answer
Score: 13

encode your html entities:

< … &lt;
> … &gt;
& … &amp;
" … &quot;
(' … &apos; xml, not html. see comments)

you might also 2 want to use

<pre><code>
here comes your preformatted and escaped &lt;html&gt;-code
</code></pre>

to have your code monospaced 1 and preserve whitespaces

Score: 1

You have to use HTML character entities 2 &lt; and &gt; in place of the < and > symbols 1 so they aren't interpreted as HTML tags.

Score: 0

To avoid issues with &apos;, use &#39;.

0

More Related questions