lundi 13 juin 2016

how to display html code in a html page in a formatted manner

My website is a simple educational one. I want to display HTML code in my web page in a formatted way like they look in a editor. I mean to say the HTML tags should appear in a different color from remaining text etc. This is a code snippet from another website. I want the output of my web page like this :- Image of desired output

This is my code :-

<html>
    <head>
        <title>HTML Tutorial</title>
    </head>
    <body>
        <div class="code">
                        <xmp>
                        <!DOCTYPE html>
                        <html>
                            <head>
                                <title>HTML Tutorial</title>
                            </head>
                            <body>
                                This is a simple HTML page
                            </body>
                        </html>
                        </xmp>
                    </div>
    </body>
</html>

How can I achieve desired behavior in my web page. I thank you all for your efforts.

Aucun commentaire:

Enregistrer un commentaire