0

I want to display the Source code of Html page as it is written on the notepad so pls, How to prevent browser from parsing the code and display the original source code of the Html Page?

Ajay
  • 5
  • 2
  • 2
    Possible duplicate of [How to display raw html code in PRE or something like it but without escaping it](http://stackoverflow.com/questions/16783708/how-to-display-raw-html-code-in-pre-or-something-like-it-but-without-escaping-it) – Beri Jan 13 '16 at 06:33
  • Have you tried googling it? The simplest way is to escape it, but I assume that you would like to have same pretty formatting of this html. – Beri Jan 13 '16 at 06:34

2 Answers2

1

You can use a Syntax Highlighter like this one: https://code.google.com/p/syntaxhighlighter/

Or you can use <code></code>

So <div class="helloworld"></div> would become:

<code>&lt;div class="helloworld"&gt;&lt;/div&gt;</code>

&lt and &gt stands for the less than and greater than brackets.

olivier
  • 2,585
  • 6
  • 34
  • 61
0

you can use "pre" tag to display source code:

<pre>code stuff</pre>

if you want to use class name with the syntax highlighter you can try as below:

<pre><code class="xyz">headerFunction</code></pre> 
Ashvin Jadav
  • 134
  • 4