- 设置背景图片格式:
background-image: url(img/ic.jpg);
-
注意点:
如果父容器面积大于背景图片,默认显示该图片整面平铺
-
设置是否需要平铺属性:
background-repeat: no-repeat(不平铺)
background-repeat: repeat-y(垂直方向平铺)
background-repeat: repeat-x(水平方向平铺)
1 .box{ 2 background-image: url(img/bdlogo.gif); 3 background-repeat: no-repeat;/*控制是否需要平铺*/ 4 background-repeat:repeat-y;/*设置垂直方向平铺*/ 5 background-repeat:repeat-x;/*设置水平方向平铺*/ 6 }