7.3 Colouring Specific Text

If you only want a particular part of your text to be coloured then you will need the <font>...</font> tag with the color attribute (again, note the American spellings):

and of course every mixture in between.

The FONT tag has been used widely, and can be used to set the precise fount, size, style and colour of text, but it is not recommended. The reason for this is that the fount commands are long and unwieldy, and must be placed separately every time they are used. A much better method to achieve the same result uses cascading style sheets (CSS) - see later on.

7.4 Other Text Effects

In addition to colouring text you can also request one of three effects:

  1. <i>...</i> the enclosed text is displayed in italics.
  2. <u>...</u> the enclosed text is underlined. This can be confusing since most browsers underline links by default.
  3. <b>...</b> the enclosed text is displayed in bold text.
  4. <strike>...</strike> the enclosed text is struck out.

In general it is best to steer clear of these effects. HTML is not a formatting language, and specifying exactly how you want things to appear goes against the spirit of the language. It is far better to indicate what is important, what you feel strongly about etc. either through describing what the content is (e.g. a link) or using logical tags:

Having said that, there are two effects that can be extremely useful in a scientific context:

There are two other useful tags to define what text is. <code>...</code> specifies that the enclosed text is to be treated as source code. Browsers usually use a different, fixed-size typeface for code segments. You can also use <pre>...</pre> to quote pre-formatted text, i.e. text that should be typeset verbatim, for example when quoting multiple lines of source code.


Previous page Next page