尤明明Blog

网站建设外包|网站切图外包,技术不仅是一种专业,更是一种责任!

您的当前位置: 首页 » 前端学习 » css+html »

ios移动端不支持background-attachment: fixed 的解决办法

2020-02-25   Umming   css+html    评论(0)    浏览(1532)


固定背景不动:background-attachment:fixed;

ios系统和某些移动端background-attachment:fixed不兼容性,没有任何效果,但可以hack一下就可以了,代码如下:

ps:想在哪个标签加背景,可以在它class后:before.

body:before {

content: ' ';

position: fixed;

z-index: -1;

top: 0;

right: 0;

bottom: 0;

left: 0;

background: url(path/to/image) center 0 no-repeat;

background-size: cover;

}

标签: html常识

本文链接:https://www.umming.com/css_html/220.html     百度已收录

声明:本站信息由网友自行发布或来源于网络,真实性、合法性由发布人负责,请仔细甄别!本站只为传递信息,我们不做任何双方证明,也不承担任何法律责任。文章内容若侵犯你的权益,请联系本站删除!


发表评论: