开发者

Fixed Background Works in Chrome but Not Firefox?

开发者 https://www.devze.com 2023-03-08 01:58 出处:网络
Am I missing something? body { margin: 0 auto; padding: 0; font-family: helvetica, sans-serif, Arial;开发者_如何学运维

Am I missing something?

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;
}


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

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

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


When using the shorthand background property, the order of the properties should be

  1. color
  2. image
  3. repeat
  4. attachment
  5. position

Try changing the style as follows (change the repeat order and add the attachment and see if it makes a difference:

background: white url(images/bg.jpg) no-repeat fixed center 0;

Then remove the background-attachment:fixed;

EDIT: Apparently mixing keywords and values will cause some browsers to choke. So centre 0 might be the issue in FF.

Try 50% 50% or center center


Try using this

background: url(under.gif) no-repeat fixed 10% 20%;

or

width: 780px;
font-family: Arial;
font-size: 0.8em;
background: url(images/bg.jpg) top left repeat-y;
border: 1px solid #e6930f

Hope this helpz...:)

0

精彩评论

暂无评论...
验证码 换一张
取 消