To format a text in bold, you can use the <b> tag (deprecated in XHTML, use CSS instead, see Section 14.12, Section
28.3!). We recall that in HTML in most cases you have to open and close the tag. Thus, the code
means that the word "Hello" shall be in bold face, while the rest of the sentence will be in normal face, since the <b> tag was closed with </b> immediately after the word "Hello".
Other formatting tags are:
But how how can we change not only the face, but also the colour, the size and the font? For this, the <font> tag comes to our help (also deprecated in XHTML, use CSS instead, see Section 14.12, Section 28.3!). Let's take a concrete example and analyze it:
<font color="#FF0000" size="2">Hello World</font>
|
The code assigns some values to attributes of the font tag, that will apply to the "Hello World" text:
-
color="#FF0000": assigns the red colour to the text. Why red? Because only the first two hex numbers are set (to FF, which is the hexadecimal notation for 255), meaning that only the red component
is active (there are three components, red, grren and blue, each one taking up two hex digits in the colur notation).
 |
Colour wheels |
|
A useful tool in exploring the visible spectrum in HTML is the colour wheel. Just hover over the wheel with your
mouse to view 4096 colors in their web safe, web smart and unsafe versions.
You can also use the colour popups of the Tag-o-matic to show all 216 web-safe colours in a virtual colour card.
|
-
size = 2: assigns the size 2 to the characters of the "Hello World" string.