您的位置:首页 > Web前端 > CSS

html/css背景图片自适应分辨率大小

2016-08-10 17:56 627 查看
<style type='text/css'>
.bgbox {
position: absolute;
left: 0;
top: 0;
width: 100%;
overflow: hidden;
bottom: 0px;
}
.bgbox-items {
overflow: visible;
}
.bgbox-items,
.bgbox-items-item{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.bgbox-items-item {
background: #fff none no-repeat center center;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
<!--[if lte IE 8]>
<style>
.bgbox-items-item1 {
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/mainbg.png", sizingMethod="scale");
}
</style>
<![endif]-->
<div class='bgbox'>
<div class='bgbox-items'>
<div class='bgbox-items-item bgbox-items-item1' style='background-image:url(images/mainbg.png)'></div>
</div>
</div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: