Adjusting the font (font, font-size and text-color) is done with the <font>-tag in HTML. The <font>-tag has a few attributes.
Changing the font is done with the face attribute. Here an example:
<html>
<head>
<title>Title of the website</title>
</head>
<body>
<font face="Comic Sans MS">
This text is written in the font Comic Sans MS
</font>
</body>
</html>
<html>
<head>
<title>Title of the website</title>
</head>
<body>
<font face="Comic Sans MS, Arial, Courier New">
This text is written in Comic Sans MS, or, if your system
doesn't support that font, it is shown in Arial. If your
system doesn't support Arial, the text is shown in Courier New.
</font>
</body>
</html>
In HTML you can also change the font-size.
That is done with the <font>-tag as well, with the size-attribute.
You can choose an absolute value, or a relative value.
The text size is always between 1 en 7, 1 being the smallest font-size, and 7 being is the biggest font-size.
Here an example of size 7 and size 1:
<html>
<head>
<title>Title of the website</title>
</head>
<body>
<font size="7">
This text is in font-size 7, the biggest possible.
</font>
<br>
<font size="1">
This text is in font-size 1, the smallest possible.
</font>
</body>
</html>
<html>
<head>
<title>Title of the website</title>
</head>
<body>
<font size="+1">
This text is 1 bigger than normal.
</font>
<br>
<font size="-1">
This text is 1 smaller than normal.
</font>
</body>
</html>
In HTML you can change the text color with the <font>-tag as well, this time with the color-attribute. It is done like this:
<html>
<head>
<title>Title of the website</title>
</head>
<body>
<font color="red">
This text is red.
</font>
<br>
<font color="green">
This text is green.
</font>
</body>
</html>
If you want to change the font, font-size and text-color all at once, it isn't necessary to use the <font>-tag, but you can place them behind each other, just like with the other tags:
<html>
<head>
<title>Title of the website</title>
</head>
<body>
<font color="purple" size="5" face="Courier New">
This text is purple, very big and has the font Courier New.
</font>
</body>
</html>
You now know how to use different fonts, font-sizes and text-colors. In the next lesson, you learn how to insert pictures and images.
⇒ Go on with Lesson 5: Images
← Go back to Lesson 3: Text Decoration
↵ Go back to the HTML-course