如何在不使用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中具有特殊含义的字符. <将变为<,>转义为>.
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 <, > is escaped to >.
根据我可以逃脱吗类中的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标签的源代码
发布评论