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):
<font color="#FF0000">
means full red, no green, no blue<font color="#00FF00">
means no red, full green, no blue<font color="#0000FF">
means no red, no green, full blueThe 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.
In addition to colouring text you can also request one of three effects:
<i>...</i>
the enclosed text is displayed in italics.<u>...</u>
the enclosed text is underlined. This can be confusing since most browsers underline links by default.<b>...</b>
the enclosed text is displayed in bold text.<strike>...</strike>
the enclosed text is 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:
<em>...</em>
the enclosed text is emphasised by the browser. It's up to the browser how it does this, but most browsers use italics.<strong>...</strong>
the enclosed text is strengthened by the browser. It's up to the browser how it does this, but most browsers use bold.<sub>...</sub>
the enclosed text is
written as a subscript. Very useful for chemical formulae
and linear algebra, e.g. H2SO4.<sup>...</sup>
the enclosed text is written as a superscript. Very useful for mathematical formulae, e.g. E=mc2.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 |