html - 如何在 html 页面中展示 html 代码?
问题描述
当我这么说的时候,我的意思是我如何让一段特定的代码不作为实际网站的一部分显示,而是作为演示给其他人看?
解决方案
有多种方法可以做到这一点
- 您可以使用
<pre></pre>
标签
<pre>
your-code
</pre>
- 使用特殊
<code>
标签
<pre>
<code>
your-code
</code>
</pre>
- 您可能希望在其中使用 HTML 代码
<![CDATA[<your-code>]]>
- 使用任何语法高亮库,例如prettify或syntaxhighlighter
推荐阅读
- r - RShiny 应用程序无法连接到 SQL Server
- php - 为用户插入的每个自定义分类术语自动创建新帖子
- apache-spark - 根据 Pyspark 数据框中的条件分配分数
- google-cloud-platform - Google Cloud Platform Pub Sub - Python 客户端不发布消息
- python - 在 Python 中使用 StatsModels 运行 GLM
- android - 我需要 scaleType="matrix" 以便在 ImageView 中拖动对象。我希望使用默认的 fit_center 使图像更小
- php - 在 PHP MYSQLI 中将 3 个或更多表链接在一起以创建墙提要
- webpack - 使用 mode 和 webpack.EnvironmentPlugin 是多余的吗?
- wordpress - 如何在没有wordpress页面的情况下重定向wp过去的网站
- c# - 我应该在哪里调用 C#.NET 中不兼容类型转换的打印函数?