Skip to main content

Character Formatting

HTML offers limited character formatting and the following attributes can be added to text:

  • Bold or strong
  • Italics or empasis
  • Underline
  • Fixed-width typeface
  • Big and small

These attributes are added using the following codes:

Italics
<i> is added to the beginning of the text to be italicised and </i> is added after the last character.
<em> is added to the beginning of the text to be emphasised and </em> is added after the last character.

Italicising text and emphasising text will produce different results and have different effects on the text with with different browsers. For example:

Here is some text italicised and emphasised and here is some italicised text which include text that is emphasised.

In the first example there might be very little difference between the italics and emphasised text but in the second example the emphasised text might be displayed as a "normal" typeface to give emphasis within an italicised sentence.
Bold
<b> is added to the beginning of the text to be in bold and </b> is added after the last character.
<strong> is added to the beginning of the text to be in a stronger style and </strong> is added after the last character.
Underline
<u> is added to the beginning of the text to be underlined and </u> is added after the last character.
Fixed width tt
<tt> is added to the beginning of the text to be presented in a fixed-width type style (type-writer) and </tt> is added after the last character.
Big and small
<big> is added to the beginning of the text to be presented in a larger font style and </big> is added after the last character.
<small> is added to the beginning of the text to be presented in a smaller font style and </small> is added after the last character.

Combinations of Character Formats

The above codes can be added in various combinations to any text. For example, this text is bold and italized.


Preformatted Text

The earlier versions of HTML did not support tables and, as shown above, HTML viewers will disregard any layout that you have placed in an HTML document. If an HTML document requires the presentation of text say, in a tabular format, then the only way that it can be viewed is to use HTML's preformatted codes.

For example, consider the following table:

                 Root gopher server: gopher.squirrel.com

      --> 1.   Information about the Squirrel Gopher Server.
          2.   What's new in the Squirrel Gopher.
          3.   Network Resources, Services and Information/
          4.   Squirrel Staff Directory
          5.   Squirrel Human Resources Information/
          6.   Potpourri, Miscellaneous Topics/
          7.   Local Squirrel Archives/
          8.   Other Gopher and Information Servers around the World/

If the preformatted codes were missed-out (but not the line break codes) the table would have the following appearance:

Root gopher server: gopher.squirrel.com

--> 1. Information about the Squirrel Gopher Server.
2. What's new in the Squirrel Gopher.
3. Network Resources, Services and Information/
4. Squirrel Staff Directory
5. Squirrel Human Resources Information/
6. Potpourri, Miscellaneous Topics/
7. Local Squirrel Archives/
8. Other Gopher and Information Servers around the World/

To keep the layout of text in an HTML document use the following codes:

<pre>
Must be added before the first character of the preformatted text.
</pre>
Must be added after the last character of the text.