<!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'>
<head>
<title>background</title>
<style type='text/css'>
p {
clear: left;
}
div {
border: 1px solid yellow;
width: 100px;
height: 100px;
margin: 10px;
float: left;
}
div#background {
background: white url('http://java2s.com/style/logo.png') no-repeat scroll center center;
}
</style>
</head>
<body>
<p>
The background shorthand property provides for specifying all
five separate background properties in one single property.
</p>
<p>
You can specify all five background properties.
</p>
<div id='background'>
</div>
</body>
</html>
div#background-color {
background: yellow;
}
div#background-image-position {
background: white url('http://java2s.com/style/logo.png') center center;
}
div#background-image-repeat {
background: url('http://java2s.com/style/logo.png') repeat-x;
}
div#background-image-repeat-attachment {
background: url('http://java2s.com/style/logo.png') repeat-y scroll;
}
<p>
You can also specify just one property or any combination of
each of the five separate background properties.
</p>
<div id='background-color'>
</div>
<div id='background-image-position'>
</div>
<div id='background-image-repeat'>
</div>
<div id='background-image-repeat-attachment'>
</div>