如何在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>

事先谢谢!

使用&gt;&lt;而不是代码。

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

使用此<h2>Box Model of &ltdiv&gt

最新更新