0

我有 .css 这使我的图像在悬停时更暗:

a.darken {
    display: inline-block;
    background: #222222;
    padding: 0;
}

a.darken img {
    display: block;

    -webkit-transition: all 0.5s linear;
       -moz-transition: all 0.5s linear;
        -ms-transition: all 0.5s linear;
         -o-transition: all 0.5s linear;
            transition: all 0.5s linear;
}

a.darken:hover img {
    opacity: 0.1;

}

我想知道如何更改它,使其在正常状态下变暗并且在悬停时正常​​?

4

1 回答 1

1

将 移至opacity: 0.1正常状态并将其恢复为1.0悬停状态:

a.darken img {
    display: block;
    opacity: 0.1;

    -webkit-transition: all 0.5s linear;
       -moz-transition: all 0.5s linear;
        -ms-transition: all 0.5s linear;
         -o-transition: all 0.5s linear;
            transition: all 0.5s linear;
}

a.darken:hover img {
    opacity: 1.0;
}
于 2013-03-16T18:11:53.897 回答