Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed attachment background image flicker/disappear in chrome when coupled with a css transform

I am currently doing a parallax website theme. The background images need to be attached as fixed for certain 'div's and 'section's to avoid jquery indulging in everything. The problem was the background images of the tags below any animated item disappeared while the transformation is being done, only on Google Chrome. Remedy?

like image 566
BlackPanther Avatar asked Nov 28 '13 14:11

BlackPanther


People also ask

How do I keep my background fixed while scrolling CSS?

To keep your background fixed, scroll, or local in CSS, we have to use the background-attachment property. Background-attachment: This property is used in CSS to set a background image as fixed or scroll. The default value of this property is scroll.

What is background-attachment fixed in CSS?

The background-attachment CSS property sets whether a background image's position is fixed within the viewport, or scrolls with its containing block.

How do you stop the background from moving in CSS?

In order to make sure the background doesn't scroll,use background-attachment: fixed;. The background-position should either use two words or two numeric measurements (ex. center center/left top/ right top/right center/left center/bottom right or 0px 0px).


1 Answers

This has been a very common unsolved mystery. Recently I had the same problem, and '-webkit-backface-visibility: hidden', proved to be less than useless (on my 'fixed' attached background), since the background just disappeared when it was set. (Additional Info: the reason is that when the background is set as fixed, it is almost similar to putting a fixed 'div' in the background and setting the original div background to be transparent. Hidden backface does the obvious).

To solve the current problem, try setting the 'position' propery of the element as 'static', or if you have given it some other value, namely 'relative', 'fixed' or 'absolute', just remove those.

If you don't remember setting the position property, and the problem still persist, my suggestion is that you use a debugging tool on chrome or firefox, to

make sure there are no manually set values to the 'position' property other than 'static'.

Just spent half an hour searching... Thought this could make it easier for you... regards. :)

like image 200
BlackPanther Avatar answered Sep 28 '22 00:09

BlackPanther