时间:2020-02-18 19:39
阅读:次
来源:网络 作者:行者整理
来源:网络 作者:行者整理
body:before {
content: "";
background: url(beijing.png) no-repeat;
background-size: 100%;
position: fixed;
top:1rem;
left:0;
bottom:0;
right:0;
z-index: -1;
因为background-attachment:fixed属性在移动端不兼容,所以我这里直接弃用了background-attachment:fixed属性,在body背景前添加了一个伪类,固定好位置不随滚动条滚动的特效就出来了。