1

I'm creating a website to help me learn web development. I want to be able to put html on my website, as if it were just text in a paragraph tag. I think that the browser thinks that the html is part of the DOM, because it never renders on the page the way I want. This is the simple code I have been using...

<pre>
    <code>
    "<!DOCTYPE html>
     <html>
     <!--All html goes here-->
     </html>
    "
    </code>
</pre>

Am I doing something wrong? How can I create a box of code on the page without the browser thinking it's part of the DOM?

Thanks in advance!

srhoades28
  • 125
  • 1
  • 2
  • 7

2 Answers2

4

Use the proper entities:

<pre>
     &lt;!DOCTYPE html&gt;
     &lt;html&gt;
     &lt;!--All html goes here--&gt;
     &lt;/html&gt;
</pre>
prodigitalson
  • 60,050
  • 10
  • 100
  • 114
2

There isn't a way to write plain HTML and have it displayed the way you want, using only HTML. The answers to this question may provide further help.

Community
  • 1
  • 1
Superfly
  • 571
  • 3
  • 13