首页 > 解决方案 > 如何在 HTML 页面上显示 HTML 片段?

问题描述

我希望我的项目<div>在网站上显示引用。我正在使用<code>标签。但是,它没有出现。这是我正在使用的一段代码:

        <div class="section">
            <h3>Additional Style</h3>
            <h2>Box Model of <code><div></code>
            <!--
            I want this code to output the following: Box Model of <div>

            However, it outputs: Box Model of

            -->
            </h2>
            <ul>
                <li>padding: 40px,</li>
            </ul>
        </div>

预先感谢!

标签: htmltagsquote

解决方案


使用&gt;and&lt;代替代码。

来源:https ://www.w3schools.com/html/html_entities.asp


推荐阅读