31

CSS value transform turn off background-attachment: fixed in Firefox.

Here is the example

div {
   transform: translate3d(0,0,0); // if remove starts to work
   width: 100%;
   height: 2000px;
   background-image: url('http://www.wallpapereast.com/static/images/001_Fish-Wallpaper-HD_hkNsK33.jpg');
   background-size: cover;
   background-attachment: fixed;
}
<div></div>

if you remove transform from CSS it starts to work. Reproducible only in FF.

AndrewL64
  • 15,794
  • 8
  • 47
  • 79
ReWWeR
  • 319
  • 3
  • 5

4 Answers4

6

background-attachment:fixed; doesn't work when any 'transform' is applied

and that's a bug in firefox and it is not yet fixed.

Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1292499

Viira
  • 3,805
  • 3
  • 16
  • 39
  • Sadly that bug report was seen as invalid as browser handle `background-attachment: fixed` as `background-attachment: scroll` _on purpose_ during transforms. Is there a way one could replace `background-attachment: fixed` to make it look right during transforms? – Ray Nov 03 '22 at 11:58
1

It was a common problem 2 years ago, but as far as I know, it has been solved a while ago, and now the background-attachment CSS Property is now fully supported by all browsers, according to MDN.

Elharony
  • 886
  • 8
  • 18
  • Although `fixed` isn't supported by iOS Safari and Samsung Internet yet: [Can I Use](https://caniuse.com/#feat=background-attachment). – Gust van de Wal Aug 28 '18 at 17:13
0

According to MDN docs when it comes to animations most background properties are discrete. Except for the background-size and background-position properties.

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/32320553) – Aaron Meese Jul 28 '22 at 00:10
  • 1
    That's true I'll take not of that – Onyela Udochukwuka Aug 02 '22 at 15:40
  • The fact that properties are discrete for animations has nothing to do with this issue in my opinion. Or maybe I don't get your answer. – Jasper Habicht Oct 25 '22 at 21:42
-3

This has been solved in this question.

Long story short- use position instead of background-attachment.

Community
  • 1
  • 1
Libi
  • 53
  • 3