如何在网页中显示文字HTML脚本? [英] How to show literal HTML script in a web page?
本文介绍了如何在网页中显示文字HTML脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些HTML脚本,希望将其显示在网页上,例如此处的代码选项:
I have some HTML script that I would like to make it display in a web page like the code option here:
<a href="#">test</a>
我该怎么做?
推荐答案
您需要对文本进行HTML转义,因为您可以轻松判断是否查看了此页面的HTML源代码:
You need to HTML-escape your text, as you can easily tell if you look at the HTML source of this very page:
<div class="post-text">
<p>I have some HTML that I would like to make it appear like the code option here</p>
<pre><code><a href="#">test</a>
</code></pre>
<p>How can I do it?</p>
</div>
这篇关于如何在网页中显示文字HTML脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文