CSS背景属性
1、 background-color 背景颜色 2、 background-image 背景图片 3、 Background-repeat repeat( 默认 ) | no-repeat | repeat-x | repeat-y 背景平铺 4 、 Background-position left | right | center | top | bottom 背景定位 ★方位值只写一个的时候,另外一个值默认居中 ★写2 个方位值的时候,顺序没有要求。 ★写2 个具体值的时候,第一个值代表水平方向,第二个值代表垂直方向。 5、Background-attachment 背景是否滚动 scroll | fixed <style type="text/css"> .box{ height: 500px; background-color: #999; background-image: url(2.png); background-repeat: no-repeat; background-position: 20px 30px; background-attachment: scroll; } </style> </head> <body> <div class="box">fixed的定位以浏览器出发,scroll以元素div定位</div> </body> 6