Planet For Application Life Development Presents
MY IT World

Explore and uptodate your technology skills...

HTML - Pre

HTML - pre

A web browser interprets your HTML document as being one long line. Sure, you may have tabs and line breaks in Notepad which align your content so it's easier for you to read, but your browser ignores those tabs and line breaks.

We showed you that you can get around this problem by using the <br /> tag, but tabs and spacing are quite different from one another and can be absolutely annoying at times. One simpler solution might be to use the <pre> tag, which stands for previously formatted text.

Use the <pre> tag for any special circumstances where you wish to have the text appear exactly as it is typed. Spaces, tabs, and line breaks that exist in your actual code will be preserved with the <pre> tag.

HTML Pre Code

<pre>
Roses are Red,
     Violets are blue,
I may sound crazy,
     But I love you!
</pre>

HTML Preformatted Result

Roses are Red,
     Violets are blue,
I may sound crazy,
     But I love you!