gpt4 book ai didi

Css 过渡和 div

转载 作者:太空宇宙 更新时间:2023-11-04 05:11:28 25 4
gpt4 key购买 nike

我有这样的dom结构:

<div class="wrapper">
<div class="style1"> ... another divs ... </div>
</div>
<div class="wrapper">
<div class="style2"> ... another divs ... </div>
</div>
<div class="wrapper">
<div class="style1"> ... another divs ... </div>
</div>
<div class="wrapper">
<div class="style2"> ... another divs ... </div>
</div>
<div class="wrapper">
<div class="style1"> ... another divs ... </div>
</div>

style1style2 中,所有内部 div(标记为“另一个 div”)都有 background-color 设置。

现在我想为 style1style2 中的所有 div 进行后台转换:

.wrapper :hover
{
background-color: #ccc;
}

.wrapper
{
-moz-transition: background .2s linear;
-webkit-transition: background .2s linear;
-o-transition: background .2s linear;
transition: background .2s linear;
}

它不起作用(没有任何变化)。当我为 style1style2 设置悬停属性时,它会改变背景,但只有主动潜水时鼠标才会结束。

最佳答案

删除 .wrapper 和 :hover 之间的空格。但我可能误读了这个。您可能想要执行 .wrapper:hover .style1 div{}

关于Css 过渡和 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9243345/

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