HTML and CSS Reference
In-Depth Information
EXAMPLE
14.3
<html>
<head><title>Colors</title>
<style type="text/css">
1
body {
font-family:cursive;
background-color: blue
;}
2
h1 {
color: #FFFF33
;} /* yellow */
3
p {
color: white
;}
</style>
</head>
4
<body>
<font size="+2">
5
<h1>Welcome to my Stylin' Page</h1>
6
<p>This paragraph is all white text on a blue background.<br />
Do you like it? I think it has potential.
</p>
</body>
</html>
EXPLANATION
1
A style is defined for the background of the document. It will be blue.
2
The text for all
<h1>
tags will be yellow (
#FFFF33
is yellow).
3
Paragraphs will have white text.
4
The body color of the page was defined in the CSS style sheet to be blue.
5
The heading level
<h1>
is displayed in its yellow style.
6
Any text enclosed in
<p> </p>
will be white against a blue body. The font was also
set by CSS. See Figure 14.3 for output.
Figure 14.3
Colored text and background.