固定的背景在Chrome中有效,但在Firefox中不可行? [英] Fixed Background Works in Chrome but Not Firefox?

查看:73
本文介绍了固定的背景在Chrome中有效,但在Firefox中不可行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想念什么吗?

body {
   margin: 0 auto;
   padding: 0;
   font-family: helvetica, sans-serif, Arial;
   color: #333333;
   font-size: 13px;
   background: white url(images/bg.jpg) no-repeat fixed top center;
}

SearchAndShare.css中的

推荐答案

有一个body {background-attachment: inherit;}规则,因为该工作表的调用时间晚于您的主工作表,所以该规则会从您的主表

in SearchAndShare.css there is a body {background-attachment: inherit;} rule which, because this sheet is being called later than your main sheet, is overruling the "fixed" from your main sheet

删除该规则可修复Firefox,不确定是否继承是对背景附件的有效调用,但即使这样,也意味着您需要设置background-attachment: fixed" on the html element so the body`可以继承的内容

removing that rule fixes Firefox, not sure if inherit is a valid call for a background-attachment but even if it is it would mean you would need to be setting background-attachment: fixed" on thehtmlelement so thebody` has something to inherit from

更新:是的,如果您不想弄乱插件SearchAndShare.css文件,则将html {background-attachment: fixed}添加到主表中也可以解决该问题

Update: Yes, if you don't want to mess with the plugin SearchAndShare.css file, adding html {background-attachment: fixed} to your main sheet also fixes it

这篇关于固定的背景在Chrome中有效,但在Firefox中不可行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆