div{
width: 1000px;
height: 700px;
border: 1px solid red;
/*背景图片,默认全部平铺*/
background-image: url("images/1.png");
}
.div1{
/*背景图片,水平平铺*/
background-repeat: repeat-x;
}
.div2{
/*背景图片,垂直平铺*/
background-repeat: repeat-y;
}
.div3{
/*背景图片不平铺*/
background-repeat: no-repeat;
}
同样的,我们可以将背景相关的属性统一用 background 设置,如下:
/*颜色 图片 图片位置 平铺方式*/
background: red url("images/1.png") 300px 10px no-repeat;
CSS背景图片布局全解析:从平铺到定位
1万+

被折叠的 条评论
为什么被折叠?



