How can I display HTML tags on a page?
I want to have the browser treat a section of the file as text rather than html code. Is there a way to have a browser treat a section as text and display it as is instead of thinking it is html tags and potentially messing up the page?
I am mostly interested in this as it would be useful when displaying sample HTML on a post.
Thank you.
After doing some research, I found two ways to display html tags on a page. One involved replacing the characters ‘<‘ and ‘>’ with < > and ” to ". The other alternative I found which I prefer is using the “Code” tag. However, I was not able to use the <code> tag as shown below:
<code>
<a href="http://JCBauza.com">My site</a>
</code>
but rather I had to do a combination of both. From the looks of it the <code> tag only allows for special formatting by the browser:
<code>
<p>
<code>
</p>
<p>
<a href="http://JCBauza.com">My site</a></p>
<p>
</code></p>
<p>
</p>
</code>