gpt4 book ai didi

html - 在悬停伪元素之前更改

转载 作者:行者123 更新时间:2023-11-28 15:38:44 26 4
gpt4 key购买 nike

所以我在网上阅读后设法在图像上创建了一个嵌入阴影..

它可以工作,但我不能让它在 :hover 上改变。

目前我有:

.shadow {
position: relative;
max-width: 100%;
float: left;
}

.shadow::before {
border-radius: 100%;
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
box-shadow: inset 3px 3px 8px rgba(0, 0, 0, .6);
transition: box-shadow .2s ease-in-out;
}

.shadow:hover:before {
box-shadow: inset 5px 5px 55px rbga(0, 0, 0, .8);
}

.shadow img {
float: left;
border-radius: 100%;
width: 300px;
}
<div class="shadow">
<img src="https://picsum.photos/300/300?image=1015">
</div>

我把代码放在这里:https://codepen.io/anon/pen/rRwGmV

我希望你们中的一些人知道如何做到这一点。

谢谢

最佳答案

.shadow {
position: relative;
max-width: 100%;
float: left;
}

.shadow::before {
border-radius: 100%;
content: "";
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
box-shadow: inset 3px 3px 8px red;
transition: box-shadow .2s ease-in-out;
}

.shadow:hover::before {
box-shadow: inset 5px 5px 55px green;
}

.shadow img {
float: left;
border-radius: 100%;
width: 300px;
}
<div class="shadow">
<img src="https://picsum.photos/300/300?image=1015">
</div>

关于html - 在悬停伪元素之前更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55078464/

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