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

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

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>


<style type="text/css">

body,div,h2,p{

margin:0;

padding:0;

}

div{

width:700px;

height:700px;

border:1px solid #000000;

color:red;

margin:10px auto;

padding:10px 0 0 10px;

background-color:#CCFFFF;

background-p_w_picpath:url(girl.jpg);

background-repeat:no-repeat;

/*background-position:right center;

background-position:bottom center;

background-position:100px 100px;*/

background-position:center center;

background-p_w_upload:fixed;


}

</style>


</head>


<body>

<div>

<h2>CSS控制背景</h2>

<p>

1.背景 background:颜色 图片 平铺方式 固定方式 位置<br />

2.背景颜色 background-color:#ccc;<br />

3.背景图片 background-p_w_picpath:url(背景图像的位置及全称)<br />

4.背景图像的平铺方式 background-repeat:repeat/no-repeat/repeat-x/repeat-y<br />

5.背景图像的位置 background-position:top/center/bottom left/center/right <br />

x y //第一个值是水平位置,第二个值是垂直位置。左上角是0 0.单位是像素(0px 0px)<br />

6.背景图片的依附方式 background-p_w_upload:scroll/fixed<br />

</p>

</div>

</body>

</html>