Tutorials & Script Homepage
HTML/DHTML 8to14
Alignment of Images
Spacing Around
Aligning Text
Image Borders
Wrapping Text Around an Image
Preformatted Text
Background images
advertisment
advertisement
advertisement
Host With Us: HostingHelper.co.uk From Only $5.00p/m
Spotted an Error ? Let us Know
100's more FREE templates at FreeWebTemplates
Looking for a new Web Host ?
Free templates from TemplatesLand
Professional High-End Templates
TemplateBox.com more FREE templates
Free Flash Templates and Intros
advertisement
 
HTML/DHTML TUTORIAL NUMBER : 13
Please Click Here, and Help Keep This Site FREE to Use
 
Please click on our sponsors advert to the right if you download or use anything from this page.
Thank you for your help.
This tutorial has been created by: WebMonkey

Preformatted Text

<pre>  turns on preformatted text
</pre> turns off preformatted text

Yes, <pre> stands for "preformatted" (not "pretentious," though that was a good guess). Preformatted text differs from regular text in two important ways: (1) It will appear in a monospaced, or fixed-width font (making it look typewritten), and (2) it will appear in the browser window exactly as you typed it, including carriage returns and spaces.

Preformatted text is best used when displaying code, ASCII art, ee cummings poetry, or anything else in which line returns and spaces are intentional and essential. But beware the perils of preformatting: You must hit return on each line, or the text w ill trail off the browser window.

The HTML for preformatted text will look something like this:

<pre>Dear Auntie Monkey,
I'd gladly borrow some carriage
returns
and s p a c e s today
         if 
you let me repay you ... tomorrow.</pre>

And the display will look strikingly similar:

Dear Auntie Monkey,
I'd gladly borrow some carriage
returns
and s p a c e s today
         if 
you let me repay you ... tomorrow.

Now, let's take the exact HTML from our example, but take it out of <pre>:

<p>Dear Auntie Monkey,
I'd gladly borrow some carriage
returns
and s p a c e s today
         if 
you let me repay you ... tomorrow.

And see how it displays:

Dear Auntie Monkey, I'd gladly borrow some carriage returns and s p a c e s today if you let me repay you ... tomorrow.

See? The line returns and spaces - so crucial to our little letter - are ignored or downplayed in regular HTML.

Preformatted text can be finicky (in some browsers, it "undoes" lists and headlines), but it can be succesfully combined with other tags. You can make it bold or italic, for instance, and you can also build links into it, as shown below:

If your HTML doc reads like this:

<pre>My stomach
       ached
          with                     laughter.
               s u p p r e s s e d 

Anyone could have <b>thought</b>
     to kick the cameraman.

       But only <a href="mailto:klug@hotwired.com">Eric</a>
            would actually <i>do</i> it.</pre>

It will display like this:

My stomach
       ached
          with                     laughter.
               s u p p r e s s e d 

Anyone could have thought
     to kick the cameraman.

       But only Eric
            would actually do it.


I hope this came in useful!
Ask in the forum if you have any suggestions or comments.

Web Hosting  |  Membership website templates  |  Dallas Web Design  |  Text Link Adds  |  Art Web Templates  |  Cheap Flight Deals  |  Domain Name Hosting  |  Digital Camera  |  Coursework Writing  |   Youth hostels  |  Internet Marketing  |  Web Design  |  Low Cost Domain Names  |  Burial Life Insurance  |  Website templates  |  Broadband Reseller  |  Dedicated Server  |  Business Broadband  |  Professionelt webdesign firma - webbureau  |  ATX Web Design - Texas TX  |  Flash Templates  |   tablet notebook  |  Machinery moving Los Angeles  |  Flash Intros  |  Web Templates  |  epi suite software  |  Cheap Web Hosting  |  web hosting  |  Website Templates  |  Corporate Logo Design Service  |  ID card printers  |  id cards  |   Free Web Hosting  |  UK Web Hosting  |  Dating Software - aeDating 4.1  |  Flash Templates  |  Website Templates  |  Power Saver  |  Website Design Quote  |  Flash templates  |  cctv cameras  |  Web Design Manchester  |  Web Templates  |   Flash templates  |  Cheap Web Hosting Deal  |  Linux Hosting  |  Web Design uk  |  Web Hosting  |  Business web directory  |  Accept Credit Cards  |  Mobile Phone Contracts  |  Car Rental Deals  |  Free domain names  |  Business Email  |  Web Designer Delhi  |  video surveillance systems  |  

 
advertisment
advertisment
advertisment
advertisment
  Top-end templates
  Credit Cards
  Reseller web hosting UK
  free flash tutorials
  Web Hosting
  Hosting Directory
  Corporate Gifts
  Company Logos
  Christian Designs
  Website Templates
  Website Templates
  Web Hosting UK
  Free Web Templates
  Custom site design
  Domain Names
  Logo Design Pro UK
  Free Flash
  templatebox.com
  freewebtemplates.com
  templatesland.com
  topfreegraphics.com
  freegraphicland.com
  free-templates-layouts
  Ink & Toner Cartridges
  Layouts4Free
  Webmaster Resoucres
  Web Templates Factory
  Free Web Templates
  Free Templates Catalog
  Web Templates
  Reseller Web Hosting
  Stock Photography
  Animations-galore.com
  4print.com.au
  Host Review
  Web Hosting Host Color
  Dedicated Servers
  FlashTemplateDesign
  ZeroDollarTemplates
  Killersites.com
  how-to-build-websites
  Build a free website
  web Hosting
  Business Logo Design
  Templates Favpage
  webmastermind.de
  flasheasy.com
  More Featured Sites