• 0

Poor performance of Chrome and Firefox using background cover


Question

Im using

background-size:cover;

to display a full screen background and it works fine in IE9, but in firefox and chrome the performance is horrible. The scroll speed is reduced and its practically a slideshow when scrolling up or down (especially in chrome).

Ive tried compressing the image to a very small size (30kbs, original is 200kb) but that has no effect).

Is there anything else i can do to optomise it or something besides turning to a jquery alternative?

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

I tried it in FF 4 b 9pre and it's perfectly fine for me

1920x1080 I even shrank the window some to scroll more and still had no problems.

My system, if it helps

Win7

Q6600 @ 3GHz

4GB ram

Link to comment
Share on other sites

  • 0

I've always found Firefox lags/slugs with fixed background images, really annoying.

Firefox 4 with hardware acceleration fixes this though. Site in the OP scrolls fine in firefox 4 beta9pre for me, its a little laggy in opera 11 (which usually has no issues with fixed background sites for me). Its REALLY laggy in chrome 10 dev, and ie9 beta scrolls the best of them all (totally smooth)

Link to comment
Share on other sites

  • 0

I've always found Firefox lags/slugs with fixed background images, really annoying.

I've seen the same thing, but not so much with recent versions.

One problem I did come across a while back when a client had a similar issue, as odd as it seems, was graphics card drivers, whereby he was using the generic windows drivers from a vanilla install instead of the manufacturers.

Link to comment
Share on other sites

  • 0

I think it's compounded by the fact that you're also using transparent PNG's on top of the fixed background - which will make scrolling even slower on those browsers than they already would be with just the fixed background.<img>

Link to comment
Share on other sites

  • 0

Performance is pretty bad in 3.6 and such, since using background-size causes it to re-scale the image on every paint (since it isn't cached), position:fixed makes it even worse since it causes the whole window to be repainted. Other browsers don't have this issue because they paint differently and cache the result of scaling images.

It won't lag in Firefox 4 since they now cache the results of scaling images and such, and cache the parts of web pages separately so re-painting the entire window is just a quick copy.

Link to comment
Share on other sites

  • 0

Yup choppy scrolling in FF 3.6. It's the same with sites like Shopto.net which I imagine is using that code as well for background display. Of course it's fine in FF4 betas because it's fixed (or accelerated).

Link to comment
Share on other sites

  • 0

no lag at all for me on chrome 10.0.612.3, very odd...

anyway,

in your css try replacing

-o-background-size:cover;

with

background-size: cover;

Link to comment
Share on other sites

  • 0

Yeah, same lag here on the latest Chrome Dev edition and it works just fine in IE8.

well its a css 3 property so it wouldnt affect IE8 as it doesnt work at all.

no lag at all for me on chrome 10.0.612.3, very odd...

anyway,

in your css try replacing

-o-background-size:cover;

with

background-size: cover;

Thats just the opera prefix, i do use background-cover as well, although i think latest versions of Opera have dropped the prefix.

Thanks for all the replies people. Seems like Chrome is the main culprit. I think i will probably resort to a javascript alternative cos that will deal with browsers that dont support css3 as well.

Hopefully this is something chrome will fix soon and its strange to see IE performing the best for a change.

Yeah, same lag here on the latest Chrome Dev edition and it works just fine in IE8.

well its a css 3 property so it wouldnt affect IE8 as it doesnt work at all.

no lag at all for me on chrome 10.0.612.3, very odd...

anyway,

in your css try replacing

-o-background-size:cover;

with

background-size: cover;

Thats just the opera prefix, i do use background-cover as well, although i think latest versions of Opera have dropped the prefix.

Thanks for all the replies people. Seems like Chrome is the main culprit. I think i will probably resort to a javascript alternative cos that will deal with browsers that dont support css3 as well.

Hopefully this is something chrome will fix soon and its strange to see IE performing the best for a change.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.