The background-color property describes the background color of browser window.
To change the background color of an entire page, the background-color property should be applied to the <body> tag. You can also apply background colors to other elements including headlines and text.
Example, apply different background colors to <body> and <h1> tags.
Code to be inserted in font.html :
<html >
<head>
<title>Example </title>
<link rel=”stylesheet” href=”ex1.css” type=”text/css” media=”all” />
</head>
<body>
<h1> Example displaying foreground and background colour.</h1>
</body>
</html>
Code to be inserted in ex1.css :
body {
background-color: #FFCC60;
}
h1 {
color: #990011;
background-color: #FC9004;
}
Note : that two properties have been applied to <h1> by dividing them by a semicolon.
Code produced by the following above code :
