Setting the Background Image

Description

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

Example

The following code sets the Background Image.


<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
p {<!-- w w w . ja v a  2 s.c  o m-->
  background-image: url(http://www.java2s.com/style/download.png);
  background-size: 20px 20px;
  background-repeat: repeat-x;
}
</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

The default value for the z-index property is zero.





















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