css transition opacity fade background

后端 未结 4 614
慢半拍i
慢半拍i 2020-12-09 08:21

I am doing a transition where it fades into transparent white, when a user is hovering an image.

My problem is that I need to change the color, that it

4条回答
  •  猫巷女王i
    2020-12-09 08:40

    http://jsfiddle.net/6xJQq/13/

    .container {
        display: inline-block;
        padding: 5px; /*included padding to see background when img apacity is 100%*/
        background-color: black;
        opacity: 1;
    }
    
    .container:hover {
        background-color: red;
    }
    
    img {
        opacity: 1;
    }
    
    img:hover {
        opacity: 0.7;
    }
    
    .transition {
        transition: all .25s ease-in-out;
        -moz-transition: all .25s ease-in-out;
        -webkit-transition: all .25s  ease-in-out;
    }
    

提交回复
热议问题