In those sites they are encoding the HTML tags. And display those encoded text in side pre HTML tag, so that browser will consider as text. If you will not do encode then browser will render as TextBox, Panel etc.
For instance, your HTML code is:
<p>This is a paragraph.</p>
Encoded format will be:
<p>This is a paragraph.</p>
Step1:
Get encoded format of your HTML tag.
Please use below link to encode your HTML tag:
http://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder[
^]
Step2:
Please put encoded tags inside pre tag.
<pre lang="HTML">&lt;p&gt;This is a paragraph.&lt;/p&gt;</pre>