Setting the Background Color

Description

We can use background-color to set a background color.

Example

The following code sets the Background Color.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
p {<!--from  w w  w. jav a2s . co m-->
  background-color: lightgray;
}
</style>
</head>
<body>
  <p>This is a test.<br/ >
  This is a test.<br/ >
  This is a test.<br/ >
  This is a test.<br/ >
  This is a test.<br/ >
  This is a test.<br/ >
  This is a test.<br/ >
  This is a test.<br/ >
  </p>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table