Setting the Font of the Whole Page
In the previous examples we've set the font properties of elements such as
<H2 ...>
or
<A ...>
. Setting the properties of the entire page isn't much different... we just set the styles for the
<BODY ...>
element.
For example, suppose we want the entire page to use a sans-serif font. We put a style like this in the <HEAD>
section:
BODY
{
font-family:sans-serif;
}
which gives us the fonts on the page you're reading right now.
A popular reason to set the fonts of the entire page is to make font colors compatible with a background color. In that case we can set all the style properties in the style. For example, the following code sets the background color of the page to black, the font to white, and the font family to sans-serif. It also sets the link color to white and the visited link color to yellow.
this code |
produces this |
<STYLE TYPE="text/css">
<!--
BODY
{
color:white;
background-color:black;
font-family:sans-serif;
}
A:link{color:white}
A:visited{color:yellow}
-->
</STYLE>
|
this page |