Skip to content Skip to sidebar Skip to footer

How Can I Display Html Source Code Within A Html Website?

I'm using the
 tag for displaying source code on a website and now need to display some HTML. I don't want the user's browser to translate and display the HTML as HTML c

Solution 1:

You'll have to use &lt; and &gt; instead of < and > respectively and browser will not consider it has html and hence will not render it. They are called as HTML Entities.

You can find and replace them or use many online services that does that for you.

Solution 2:

Use the HTML tag <code> for your snippet.

Here's more on the subject <code> vs <pre> vs <samp> for inline and block code snippets

Post a Comment for "How Can I Display Html Source Code Within A Html Website?"