what is the use of a "PRE" tag in (X)HTML
It is used to demonstrate pre-formatted text, where new-line breaks are relevant. For instance, ascii art ;-) or program code. Well, for program code the CODE element is better.
The PRE element represents a character cell block of text and is suitable for text that has been formatted for a monospaced font.
The PRE tag may be used with the optional WIDTH attribute. The WIDTH attribute specifies the maximum number of characters for a line and allows the HTML user agent to select a suitable font and indentation.
It's for displaying data/code/art where you want all your spaces and newlines to be displayed as is, and want your columns to line up. So you can do stuff like this:
+-----+------------------+--------+------------+
| id | session_key | length | expires |
+-----+------------------+--------+------------+
| 263 | SNoCeBJsZkUegA7F | 86400 | 1257401198 |
| 264 | UoVm3SZRmPHnac4V | 86400 | 1257405561 |
| 262 | bjkIOWBhI1qxcrWr | 86400 | 1257401189 |
+-----+------------------+--------+------------+
without "pre" or "code" or some such, this looks like this:
+-----+------------------+--------+------------+ | id | session_key | length | expires | +-----+------------------+--------+------------+ | 263 | SNoCeBJsZkUegA7F | 86400 | 1257401198 | | 264 | UoVm3SZRmPHnac4V | 86400 | 1257405561 | | 262 | bjkIOWBhI1qxcrWr | 86400 | 1257401189 | +-----+------------------+--------+------------+
Have you ever looked an article posted in code project site ? If you didn't take a look at it this http://www.codeproject.com/KB/game/Hangman_game.aspx. From the article the yellow section or the one with collapse and expand code snippet are pre taged. It helps to preserve the data the way it is written or presented as it is without distorted.