Table of Contents

What is required to display Raw HTML code on a Webpage?

In order to display HTML code on a webpage, you need to get rid of start tag < and end tag > symbol of every tag in your HTML code.

< character is replaced by &lt;
> character is replaced by &gt;

 

Sample Code
<!DOCTYPE HTML>
<html>
    <head>
        <link rel="stylesheet" href="index.css">
        <link href="style.css" rel="stylesheet">
     <link href="grid.css" rel="stylesheet">
    </head>
    <body>
    
    </body>
</html>

 

Display code

 

&lt;!DOCTYPE HTML&gt;

&lt;html&gt;

    &lt;head&gt;

        &lt;link rel="stylesheet" href="index.css"&gt;

        &lt;link href="style.css" rel="stylesheet"&gt;

     &lt;link href="grid.css" rel="stylesheet"&gt;

    &lt;/head&gt;

    &lt;body&gt;

    &lt;/body&gt;

&lt;/html&gt;
Now enclose the code in pre tag or code tag.

 

If your code is already preformatted, place the code inside 

<pre>...........</pre>

 

Or if the code is not formatted first place it in code tag then enclose it with pre tag.

<code><pre> ...... </pre> </code>

 

Use the online tool to display Raw HTML code on a Web page.

Follow the below steps:

    • Paste your code in the tab html.txt (You can also format the code in the given tab)
    • Execute the Run  button shown in the window
    • Copy the output code from the Result window or copy it from html-display-code-web-page.txt file
    • Place the code in Pre HTML tag to preserve the formatting.