背景属性
背景颜色
div{ height: 200px; width: 200px; background-color: #ccc; }
背景图片
div{ height: 200px; width: 200px; background-image: url(img/bg.png); }
背景重复
div{ height: 200px; width: 200px; background-image: url(img/bg.png); background-repeat: repeat-x; /* 不添加此属性,则纵向横向都重复 repeat-x 横向重复 repeat-y 纵向重复 no-repeat 不重复 */ }
背景位置
background-position: x y; /*xy分别表示x轴位置和y轴位置*/ /* 横向(left,center,right) 纵向 (top, center,bottom) */