Jump to content

background-attachment:


bhazzard

Recommended Posts

okay so I have a huge gripe with the specs for the "background-attachment:" values available to us in css. Scroll means that the background image will scroll within the containing element.Fixed is a little more controversial. in IE, Fixed means that the background image is fixed to the containing element; In Mozilla it means it is fixed to the viewport. According to the specs, IE is in the wrong, but according to useful applications, I think IE was on to something.Obviously there are applications for fixed the way it stands... but there are millions of applications for fixed the way IE treats it, perhaps more applications than there are for the proper treatment of the value.So why havent we caught on to this and created a new value that allows us to fix a background to the containing element? That way developers would have so much more power in their background image arsenal.I say this needs to happen quickly!!!!

Link to comment
Share on other sites

  • 2 years later...

I ran a small test and created a DIV with a background image, not fixed at first. This is the code I used:HTML:

 <div id="fixed-bg">   <p>fixed-bg</p>   <p>fixed-bg</p>   <p>fixed-bg</p>   <p>fixed-bg</p>   <p>fixed-bg</p>   <p>fixed-bg</p>   <p>fixed-bg</p>   <p>fixed-bg</p>  </div>

CSS:

#fixed-bg { width:200px; height:200px; background:url(background.jpg); overflow:auto;}

Surprise, surprise, Firefox 2.x FIXES the background to the container even when the background: declaration does not have the fixed property in it. But IE6/7 handle the declaration properly: when fixed is applied, it fixes the background, when it's not applied, it scrolls properly with the content.It's... supposed... to... work in... Firefox! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...