Search code examples
htmltagsquote

How can I display an HTML snippet on an HTML page?


I want my project to display <div> quoted on the website. I am using the <code> tag. However, it doesn't appear. This is the piece of code I am using:

<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>

Solution

  • Use &gt; and &lt; instead of code.

    Source: HTML Entities