Write source code in HTML page content

The

 tag is used to create preformatted text.  This simply means that newline, space, and tab characters are taken into account.  HTML would ignore them by default.

What happens is that html tags are still tags. As much as you use the

 tag, what you put inside is HTML code.  That's why it processes it for you and renders the labels.  The case of the CSS code is different because it does not have tags, so it shows it to you well in a 
 tag.

The solution is to use the special characters for the symbols greater than and less than. I mean < for the < symbol and > for the > symbol. This way you get that the tags of your code are not really tags and are not displayed as such. Instead, they will be text with symbols that the browser will not understand as labels.

Another important detail, which is not necessarily necessary, but is recommended, above all from the point of view of semantics, is that you use the tag inside the

 tag.  As I say,  is not needed for the text to be converted to code, but rather for it to be displayed as such on the page.  The browser will use the style that it has assigned to the code, but above all, other systems such as robots that read the page will be able to know that this block of text is a block of code.

To make it clearer, I will give you an example of how a block of HTML code could look more or less, so that it can be seen correctly in an HTML document when displayed in the browser.

<ul>  <li>Item 1 <b>Code shown</b></li>  <li>Item 2 <i>HTML as code</i></li>  <li>Item 3</li>  
See also  Usability on the web
Loading Facebook Comments ...
Loading Disqus Comments ...