1.背景色
background-color: red; /*设置背景色为红色*/
2.背景图片
background-image: url('../img/1.jpg'); /*设置背景图片(默认平铺)*/ background-repeat: no-repeat; /*不平铺*/ background-repeat: repeat-x; /*横向平铺*/ background-repeat: repeat-y; /*纵向平铺*/ background-position: 20px 100px; /*设置背景图片位置X轴20px,Y轴100px*/ background-position-x: 30px; /*单独设置x轴位置*/ background-position-y: 30px; /*单独设置y轴位置*/
3.背景定位
关键字:
background-position: top left; /*背景图片设置在左上方*/ background-position: top center; /*顶部中间*/ background-position: center right; /*右边中间*/ background-position: center center; /*中心位置*/
百分比:
background-position: 50% 50%; /*中心位置*/ background-position: 100% 100%; /*右下角*/