how to show code snippet in html code example

Example 1: insert code snippet into html

<pre class="line-numbers">
  <code class="language-css">
    p { color: red }
  </code>
</pre>

/* The following language classes are supported:
language-markup – Use for HTML, XML, etc…
language-css
language-clike
language-javascript
language-java
language-php
language-scss
language-bash
language-python
language-sql
language-https
language-csharp
language-aspnet
language-scala
language-haskell
language-objectivec
language-latex
language-git */

Example 2: how to insert code in html

<pre>
  <code>
  &ld;code&gt;
  </code>
</pre>

Example 3: how to insert code in html

<pre><code>&lt;pre&gt;
  &lt;code&gt;
    p { color: red; }
    body { background-color: #eee; }
  &lt;/code&gt;
&lt;/pre&gt;</code></pre>

Tags:

Html Example