Search code examples
cssimagehoverscaleopacity

CSS image hover / scale works great in chrome but not IE


I am working on a website and i have a horizontal table with 4 images that I want to scale larger when hovered. I also have an opacity effect that they become solid when hovered on. It works great on chrome but they images are at 100% opacity and do not scale larger when hovered on IE.

jsfiddle: https://jsfiddle.net/u9hk6x5y/

#hoverimage {
    text-align:center;  
    margin-left:13%;
    margin-right:13%;
    z-index: 9999;  
}

#hoverimage1 {
    width: 162px;
    float: left;
    margin-right: 10px;
    z-index:9999;
}

#hoverimage2 {
    width: 162px;
    float: left;
    margin-right: 10px;
    z-index: 9999;
}

#hoverimage3 {
    width: 162px;
    float: left;
    margin-right: 10px;
    z-index: 9999;
}

#hoverimage4 {
    width: 162px;
    float: left;
    margin-right: 10px;
    z-index: 9999;
}

#hovergallery{
-webkit-transition-duration: 0.5s; /*Webkit: Animation duration*/
-moz-transition-duration: 0.5s; /*Mozilla duration version*/
-o-transition-duration: 0.5s; /*Opera duration version*/
transition-duration: 0.5s;
opacity: 0.8; /*initial opacity of images*/
margin: 0 20px 10px 0; /*margin between images*/
}

#hovergallery:hover{
-webkit-transform:scale(1.4); /*Webkit: Scale up image to 1.2x original size*/
-moz-transform:scale(1.4); /*Mozilla scale version*/
-o-transform:scale(1.4); /*Opera scale version*/
-ms-transform:scale(1.4);
transform: scale(1.4);
opacity: 1;
}

Solution

  • You said 4 images, but using id selector, change that to class selector, since id must be unique per page

    UPDATE

    This is what I said (do this for all your <img /> tags, btw I just checked and worked fine on IE, Chrome & Firefox.

    <img class="hovergallery" height="240px" width="162px"  src="images/toolreconditioninggraphic.png" />
    
    .hovergallery{
        -webkit-transition-duration: 0.5s;
        -moz-transition-duration: 0.5s;
        -o-transition-duration: 0.5s;
        transition-duration: 0.5s;
        opacity: 0.8;
        margin: 0 20px 10px 0;
     }
    
     .hovergallery:hover{
        -webkit-transform:scale(1.4);
        -moz-transform:scale(1.4);
        -o-transform:scale(1.4);
        -ms-transform:scale(1.4);
        transform: scale(1.4);
        opacity: 1;
    }