Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opacity Bug in Latest Version of Chrome - CSS Transforms

This bug introduced itself in Chrome only in the last couple of weeks

https://jsfiddle.net/foreyez/zbjdnete/

Basically, change the opacity to something less than 1 inside the 'grid-item' class in the css and you'll see that the sides of the 3d box disappear.

So basically change the css:

.grid-item {
    margin:5px;
    animation: float 3s ease-in-out infinite;
    position:absolute;
    float:left;
    transform-style: preserve-3d;
    width:100px;
    display:block;
    height:100px;
    background:yellow;
    opacity:0.9; /* <<<<< CHANGE THIS */
}

If the opacity is less than 1 the inner transforms inside the div disappear, any ideas what happened or workarounds?

like image 673
Shai UI Avatar asked Feb 01 '26 18:02

Shai UI


2 Answers

I will suggest you to change your grid-item class to the following:

.grid-item {
margin:5px;
animation: float 3s ease-in-out infinite;
position:absolute;
float:left;
transform-style: preserve-3d;
width:100px;
display:block;
height:100px;
background: rgba(255, 255, 0, 0.3); 
}

Still I have no idea why the bug is reproducible on latest version of chrome but this workaround should do the trick.

like image 185
achref Avatar answered Feb 04 '26 07:02

achref


For anyone running into this when trying to apply opacity on images layed out as grid items, the filter property comes in handy.

.grid-item {
   // other properties...
   filter: opacity(80%);
}

while not supported by ie, the overall support looks pretty good.

like image 40
Hans Spieß Avatar answered Feb 04 '26 09:02

Hans Spieß



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!