HTML Tips - Text
(Page 2 of 5 )
Paragraphs
If you have text made of paragraphs, make each paragraph the content of a P element. This way you can give each paragraph consistent formatting. This policy can also be helpful when you want to create a template for a web page.
When to use Preformatted Text
Scientific analysis, such as mathematical solutions and programming code (segments), are usually presented in a particular format. A lot of white space is used with such presentation. Put this type of presentation within the content of the PRE element. Any arrangement of text in the PRE element appears on the web page exactly as it is in the PRE element. Other examples of what you can put in the PRE element are poems and lyrics of songs. The following example shows how a mathematical solution is preformatted:
<pre>
<b>Example</b>
Find the LCM of 36, 54, 60 and 80.
<b>Solution</b>
36 = 2 X 2 X 3 X 3
54 = 2 X 3 X 3 X3
60 = 2 X 2 X 3 X 5
80 = 2 X 2 X 2 X 2 X 5
LCM = 2 X 2 X 2 X 2 X 3 X 3 X 3 X 5
= 16 X 27 X 5
= <u>720</u>
</pre>
On a web page this will appear as follows:
Example
Find the LCM of 36, 54, 60 and 80.
Solution
36 = 2 X 2 X 3 X 3
54 = 2 X 3 X 3 X3
60 = 2 X 2 X 3 X 5
80 = 2 X 2 X 2 X 2 X 5
LCM = 2 X 2 X 2 X 2 X 3 X 3 X 3 X 5
= 16 X 27 X 5
= 720
Note that the PRE element can have other elements, such as the Bold and Underline elements.
Also note: the horizontal tab character is usually interpreted by browsers as the smallest non-zero number of spaces necessary to line characters up along tab stops that are every 8 characters. I strongly discourage you from using horizontal tabs in preformatted text because this would lead to misaligned documents.
Increasing Vertical Spaces
The Line Break element causes the next element to appear on the next line. A line break at the beginning of a block creates a blank line at the beginning of the block. You can increase the vertical space in a block using the line break "<br />" element.
Next: Lists >>
More HTML Articles
More By Chrysanthus Forcha