HTML Preformatting (HTML Formatting Tags part 4)

১১/১৮/২০১১ ০৯:০২:০০ AM | | 0 comments »

A web browser interprets your html document as being one long line. Sure, you may have tabs and line breaks in notepad aligning your content so it is easier to read for you the web master your browser ignores those tabs and line breaks.

We showed you one way to get around this by using the ltbr /> tag. Tabs and spacing are quite different, and absolutely annoying at times. One simple solution might be to use the <pre> tag, standing 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 Code:

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

Preformatted Text:

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