如何在网页上显示HTML代码(实体)?

Kev*_* Li 7 html

你怎么写html代码让用户在网页上看到它(比如html的方法)

kni*_*ttl 13

编码你的html实体:

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

你可能也想用

<pre><code>
here comes your preformatted and escaped &lt;html&gt;-code
</code></pre>
Run Code Online (Sandbox Code Playgroud)

让代码等宽并保留空格