Text Formatting Tags

You are not authorized to view comments.
Submitted by Syscrusher on Mon, 2005/06/06 - 23:33.

These tags, like the document part tags, are quite frequently used. Luckily these are among the easiest to learn, and most of them are quite intuitive.

Use the text formatting tags on any text in the document body, but not in the document header area. It is okay, for instance, to use an <i> tag (see below) to italicize part of a heading.

<h3>This is a <i>third level</i> heading!</h3>

will display as

This is a third level heading!

The text tags can be used within a word as well, and their presence does not imply any spacing or line break.

<em>some text here</em>

The text within the tag is emphasized. Exactly what that means is left up to the browser.

<strong>some text here</strong>

The text within the tag is strongly emphasized. Exactly what that means is left up to the browser.

<b>some text here</b>

The text within the tag is boldfaced. Systems (such as some text terminals) that cannot do boldface type may use some other emphasis technique.

<i>some text here</i>

The text within the tag is italicized. Systems (such as some text terminals) that cannot do italic type may use some other emphasis technique.

<u>some text here</u>

The text within the tag is underlined. CAUTION: Most browsers use underlining to highlight hyperlinks, so if you use it for text emphasis it can be very confusing to the user.

<code>some text here</code>

The text within the tag is a program listing (code). Exactly what that means is left up to the browser, but in most instances the text will be drawn in a non-proportional font. This is because most programming is done in a text editor, rather than in a word processor, and programmers are used to being able to line up their code in the old typewriter-style method.

<font face=typeface color=color size=size>some text here</font>

The text within the tag is displayed in a different font. As mentioned earlier in this tutorial, the use of this tag is a request to the browser, and it may or may not have any effect.

typeface is the name of the requested typeface. You may specify alternate typefaces separated by commas, and you should generally put the string into double quotes. For example, <font face="Arial,Swiss,SansSerif">.

color can be a common color name or a hexadecimal value, as described in the preamble to the basic tags page. The color cannot override the color of a hyperlink -- these are specified in the <body> tag only.

size is a number from one (smallest) to six (largest). The exact point size on the screen is up to the browser. You can also precede the number with a plus or minus sign, in which case the number is added or subtracted with the size number of the text around it. For instance, <font size=-1> will cause the following text to be slightly smaller than the preceding text (unless of course the preceding text was already at the smallest size).

Remember that the typeface is found by the browser on the visitor's computer, and what you have on the computer where you created the page is totally irrelevant.

The closing tag </font> resets the text to whatever was in effect before the last <font> tag. You can nest <font> tags within one another, as well. For example, this HTML code:

This is <font color=red>some red text <font size=+1>and this is big</font> but <font size=-1>this is small</font> and</font> this is back to regular.

will look like this:

This is some red text and this is big but this is small and this is back to regular.

( categories: | )