如何在HTML页面上显示HTML代码段?

问题描述 投票:0回答:2

我希望我的项目显示网站上引用的<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>

预先感谢!

html tags quote
2个回答
0
投票

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


0
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.