How to Display HTML code on Web Page?

To display html tags in html format we have to use different ways. You can convert your html code in html special Characters to show tags into you Page. After convert special Characters you use <pre>. The <pre> tag is quite useful for displaying organized code. Otherwise your html code display in one line.

Ex-

<pre>
&lt;html&gt;
&lt;head&gt; 
  &lt;title&gt;w3-html&lt;/title&gt; 
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt; Welcome w3-html!&lt;/h1&gt;
    &lt;p&gt; Write HTML, Javascript or CSS here &amp; click run code!&lt;/p&gt;
&lt;/body&gt; 
&lt;/html&gt;
</pre>

Output

<html>
<head> 
  <title>w3-html</title> 
</head>
<body>
    <h1> Welcome w3-html!</h1>
    <p> Write HTML, Javascript or CSS here & click run code!</p>
</body> 
</html>
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments