gpt4 book ai didi

javascript - 将图像悬停使其变暗

转载 作者:行者123 更新时间:2023-11-30 07:16:07 25 4
gpt4 key购买 nike

只是想知道悬停图像如何使其变暗?使用 jquery/css。

我的CSS

.img-files{
background:url("/Images/syzs.png") no-repeat;
position:absolute;
background-size:90%;
width: 100px;
height: 150px;
text-indent: -9999px;
z-index:1;
}

最佳答案

你可以使用带有不透明度属性的黑色背景让它变得更好

Demo

.dark {
display: inline-block;
background: black;
}

.dark img {
display: block;
transition: all 0.5s linear;
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
}

.dark:hover img {
opacity: 0.5;
}

关于javascript - 将图像悬停使其变暗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17036699/

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