Displaying xml codes without rendering symbols

I want to be able to display the characters & l t ; as well as other xml codes, without it rendering the actual symbol, like whats happening on this table from MDN

Only problem is that every way I’ve tried it my browser still renders it as a symbol instead of the characters I want.

Here’s the code I’m using;


<div class="code-container">
<!-- This ends up displaying < on the page -->


  max-width: 80%;
  background-color: #434546;
  margin: 25px 0 0 40px;
  min-height: 50px;
  border-radius: 5px;
  text-align: left;
  height: auto;
  vertical-align: middle;

pre code{
  font-family: monospace;
  font-size: 1.09rem;

Any help would be appreciated.

For example:

  <li><code><strong>&amp;lt;</strong> - stands for "&lt;"</code></li>
  <li><code><strong>&amp;gt;</strong> - stands for "&gt;"</code></li>
  <li><code><strong>&amp;amp;</strong> - stands for "&amp;"</code></li>

Use analogy for other characters.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.