Bookmark and Share

HTML - <pre> Preformatting

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.

Advertise on Tizag.com

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 Text:

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




Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

Advertise Here

More Tutorials!
Microsoft Office Tutorials Artist Tutorials