gpt4 book ai didi

悬停时CSS3暗图像

转载 作者:太空宇宙 更新时间:2023-11-04 15:09:55 24 4
gpt4 key购买 nike

我有 .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;

}

我想知道我怎么能改变它在正常状态下变暗并且在悬停时正常​​?

最佳答案

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;
}

关于悬停时CSS3暗图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15452805/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com