Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

image moves on hover - chrome opacity issue

There seems to be an issue with my page here: http://www.lonewulf.eu

When hovering over the thumbnails the image moves a bit on the right, and it only happens on Chrome.

My css:

.img{     -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";     filter:alpha(opacity=50);     -moz-opacity: 0.5;      opacity: 0.5;     -khtml-opacity: 0.5;     display:block;     border:1px solid #121212; } .img:hover{     -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";     filter:alpha(opacity=100);     -moz-opacity: 1;      opacity: 1;     -khtml-opacity: 1;       display:block; } 
like image 361
zefs Avatar asked Oct 19 '12 18:10

zefs


2 Answers

Another solution would be to use

-webkit-backface-visibility: hidden; 

on the hover element that has the opacity. Backface-visibility relates to transform, so @Beskow's has got something to do with it. Since it is a webkit specific problem you only need to specify the backface-visibility for webkit. There are other vendor prefixes.

See http://css-tricks.com/almanac/properties/b/backface-visibility/ for more info.

like image 57
alpipego Avatar answered Oct 05 '22 23:10

alpipego


For some reason Chrome interprets the position of elements without an opacity of 1 in a different way. If you apply the CSS attribute position:relative to your a.img elements there will be no more left/right movement as their opacity varies.

like image 33
Rick Giner Avatar answered Oct 06 '22 01:10

Rick Giner