标签:情况下 width jpg add 最小 repeat 地址 clip 比例
div{
width:400px;
height:400px;
border:1px solid #000000; //边框
background-image:url(bg1.jpg),url(bg2.jpg); //背景图片
background-position: top left,center right; //背景位置:第一张图左上 第二张居中靠右
background-repeat:no-repeat,no-repet; //背景平铺:不平铺
}
效果

div{
width:400px;
height:400px;
border:1px solid #000000;
background:url(“bg1.jpg”) top left no-repeat,
url(“bg2.jpg”) center right no-repeat;
}
div{
width:400px;
height:400px;
border:1px solid #000000;
background:url(“bg1.jpg”) top left no-repeat,
url(“bg2.jpg”) center right no-repeat;
//如果我们给定的图片是长500 宽500像素的图片,那么这个div的背景就不能完全的显示
Background-size:400px 400px //设置背景图片尺寸和div相同
}
div{
width:400px;
height:400px;
border:1px solid #000000;
background:url(“bg1.jpg”) center/contain no-repeat,
}





标签:情况下 width jpg add 最小 repeat 地址 clip 比例
原文地址:https://www.cnblogs.com/xiaowie/p/9824565.html