Web Development Tutorials.com

How to set the background color of a web page with CSS


Click Here for CoffeeCup Website Design Software   GoDaddy.com Hosting & Servers

The below HTML and CSS code example shows you how to set the background color of a web page with CSS.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>this is the title of the web page</title>

<style type="text/css">

body
{
background-color: yellow;
}


</style>

</head>
<body>

<p>
This web page has a yellow background color.
</p>

</body>
</html>

The following link is the web page that the HTML and CSS code above creates: background color example.

Use the text editor below to practice setting the background color of a web page with CSS.