显示没有XMP标签的源代码 [英] Show source code without XMP tag

查看:297
本文介绍了显示没有XMP标签的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用HTML5网站上的XMP元素的情况下显示包含标记的HTML标记?

How do I show HTML markup including tags without using the XMP element on an HTML5 website?

该网站使用HTML5制作,并显示有关HTML,C ++等的教程.

The website is made with HTML5 and shows tutorials about HTML, C++ etc.

所以我需要显示许多编程语言的源代码.

So I need to show the source code of many programming languages.

推荐答案

最常用的替代方法是使用<pre><code>元素并转义在HTML中具有特殊含义的字符. <将变为&lt;>转义为&gt;.

The most often used alternative is to use the <pre> or <code> element and escape characters that have a special meaning in HTML. < would become &lt;, > is escaped to &gt;.

根据我可以逃脱吗类中的html标签(重新创建xmp标签)?,您仍然可以使用XMP标签.尽管根据>< XMP>标记?? <pre>是首选使用元素.

According to Can I escape html tags within a class (recreate the xmp tag)?, you can still use the XMP tag. Browsers should still support it, although according to What was the <XMP> tag used for?, <pre> is the preferred element to use.

这篇关于显示没有XMP标签的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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