温故而知新–有出现bug了
背景图片适配pc端
html{
width: 100%;
height: 100%;
overflow-x:hidden;
overflow-y:hidden;
}
body{
width:100%;
min-height: 100%;
background-image:url(../images/houtai/[email protected]);
background-position: center 0;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
-ms-background-size: cover; }
其中background-size中的cover和contain,还有100%之间的区别
eg.
cover:是按照等比缩放铺满整个区域。如果显示如果显示比例和显示区域的比例相差很大某些部分会不显示,比如长度比宽度大很多,则宽度左侧会有一部分不显示。
contain:也是等比缩放,按照某一边来覆盖显示区域的,会有白边
100%:长宽100%显示,可能会拉升图片。
希望给正在工作的前端小伙伴一点小小的帮助—Lby。