How to display html code in a html page in a formatted manner
<p>My website is a simple educational one. I want to display HTML code in my web page in a formatted way like they look in a editor. I mean to say the HTML tags should appear in a different color from remaining text etc. This is a code snippet from another website. I want the output of my web page like this:</p>

<p><a href="https://i.stack.imgur.com/1cczx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1cczx.png" alt="enter image description here"></a></p>

<hr>

<p>This is my code :-</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;

&lt;head&gt;
    &lt;title&gt;HTML Tutorial&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;div class="code"&gt;
        &lt;xmp&gt;
            &lt;!DOCTYPE html&gt;
            &lt;html&gt;

            &lt;head&gt;
                &lt;title&gt;HTML Tutorial&lt;/title&gt;
            &lt;/head&gt;

            &lt;body&gt;
                This is a simple HTML page
            &lt;/body&gt;

            &lt;/html&gt;
        &lt;/xmp&gt;
    &lt;/div&gt;
&lt;/body&gt;

&lt;/html&gt;</code></pre>
</div>
</div>
</p>

<p>How can I achieve desired behavior in my web page. I thank you all for your efforts.</p>