css-背景全铺

 

 

背景全铺

body {
    width: 100%;
    height: 100%;
    min-height: 665px;
    background: url(../img/login-bg.png) #386eb7 no-repeat bottom;
    background-size: cover;
    background-attachment: fixed;
    min-width: 930px;
}

   部分移动端效果不显示

兼容解决

.bg{
  background:#64bed4;
  background:linear-gradient(#2a8ea0, #64bed4) ;

  background:-moz-linear-gradient(#2a8ea0, #64bed4);
  background:-webkit-linear-gradient(#2a8ea0, #64bed4);
  background:-o-linear-gradient( #2a8ea0, #64bed4);
  background-repeat:no-repeat;
  height: 100%;
  min-height: 1268*@fs1;
  /* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */
  background-attachment: fixed;
  font-size: 28*@fs1;
  position: fixed;
  z-index: 1;
  left: 0;
  bottom: 0;
  top: 0;
  width: 100%;
  &:before{
    content: "";
    position: fixed;
    z-index: -1;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-image: inherit;
    background-size:750*@fs1 1624*@fs1!important;
    -webkit-background-size: 750*@fs1 1624*@fs1!important;
    -o-background-size:750*@fs1 1624*@fs1!important;
}
  &::after{
 
    content: '';
    display: block;
    position: fixed;
    bottom: 0;
    z-index:-1;
    width: 100%;
    height: 389*@fs1;
    background: url(../img/bg_btm.png) no-repeat bottom;
    background-size:750*@fs1 389*@fs1;
  }
 
}

  效果

 

 

 

 

posted @ 2019-10-14 16:47  明媚下雨天  阅读(216)  评论(0)    收藏  举报