如何在HTML上打印代码 [英] How to print code on HTML

查看:88
本文介绍了如何在HTML上打印代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在HTML页面上显示代码字符。但无论我尝试什么,总是呈现HTML字符。 pre code 不起作用。



例如:

 < XMP> 
< p> Blah& nbsp;< / p>
< / xmp>

...会在您的屏幕上看起来像这样:

 < p> Blah& nbsp;< / p> 


I want to display code characters on an HTML page. But no matter what I try it always renders HTML characters. pre or code doesn't work. How can I do this?

解决方案

The <xmp> tag doesn't require the contents to be escaped.

eg:

<xmp>
    <p>Blah &nbsp;</p>
</xmp>

...will look like this on your screen:

    <p>Blah &nbsp;</p>

这篇关于如何在HTML上打印代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆