Text in HTML document are typically entered between the paragraph tags: <P> and </P>.
| Paragraph tag | <P> |
| End tag | </P> (optional) |
| Attributes | ALIGN (left, right, center) |
| Example |
<P ALIGN=LEFT> left-justified paragraph </P> |
An HTML paragraph contains only one space between letters even if your typed code contains more spaces. Furthermore, line breaks typed in the code appear as a space. To introduce a line break into an HTML paragraph, use <BR> tag. To add spaces between characters, use " ". Below are some examples:
| HTML code | What the browser displays |
| <P> three spaces </P> | three spaces |
| <P> three spaces </P> | three spaces |
| <P> two lines </P> | two lines |
| <P> two<BR><BR>lines </P> | two lines |
To insert symbols into an HTML code, you need to know their name or number code. Below are several commonly used symbols; for a complete listing go to Webmonkey.
| Code | Description | |
| | blank space | |
| < and > | brackets < > | |
| © | copyright symbol © | |
| ° | degrees symbol ° | |
| ² | squared ² |
Horizontal lines can be drawn in a document using <HR> tag. Attributes are SIZE=# to set the line width in pixels, and WIDTH=# to set the span of the line across the page in pixels or percent. For example, <HR SIZE=5 WIDTH=50%> looks like:
Any text in the HTML file can be formatted using tags.
| Tag Pair | Description | |
| <B> </B> | Bold | |
| <U> </U> | Underline | |
| <I> </I> | Italics |
These tags can be used in combination. Furthermore, font size can be varied using <FONT SIZE=#> and </FONT> tags. Font size can be specified by relative scale (+2, +1, 0, -1, -2, ...) or by absolute sizes.
Exercise 2
|