悬停在其中一个时调整多个元素的大小
我遇到了一个问题,这是我问题的一个例子:
<div class="Sample">
<div class="Dummy">
<div class="Books">
<a style="width: 14%; margin-left: 1%; margin-right: 1%;">DUMMY 1</a>
<a style="width: 14%; margin-left: 1%; margin-right: 1%;">SAMPLE 1</a>
</div>
</div>
<div class="Dummy">
<div class="Prices">
<img src="https://www.lexis.se/wp-content/uploads/2022/01/ARD28940SS-scaled.jpg">
<a style="width: 14%; margin-left: 1%; margin-right: 1%;" class="">
DUMMY 2
<a style="width: 14%; margin-left: 1%; margin-right: 1%;" class="">
SAMPLE 2
</div>
</div>
</div>
https://jsfiddle.net/k1y8afst/ 虚拟2“要调整相同转换的大小。”样本1和“样本2”应以相同的方式链接在一起。我不知道如何做到这一点,您将如何做?
I ran into a problem and here is an example of my issue:
https://jsfiddle.net/k1y8afst/
<div class="Sample">
<div class="Dummy">
<div class="Books">
<a style="width: 14%; margin-left: 1%; margin-right: 1%;">DUMMY 1</a>
<a style="width: 14%; margin-left: 1%; margin-right: 1%;">SAMPLE 1</a>
</div>
</div>
<div class="Dummy">
<div class="Prices">
<img src="https://www.lexis.se/wp-content/uploads/2022/01/ARD28940SS-scaled.jpg">
<a style="width: 14%; margin-left: 1%; margin-right: 1%;" class="">
DUMMY 2
<a style="width: 14%; margin-left: 1%; margin-right: 1%;" class="">
SAMPLE 2
</div>
</div>
</div>
When I hover over "Dummy 1" then I also want "Dummy 2" to resize in same transformation."Sample 1" and "Sample 2" should be linked together in the same way. I can't figure out how I can do this, how would you do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
据我所知,对于您的标记,纯CSS是不可能的。
但是,您可以使用一些JavaScript来实现此效果相对容易。这是您如何用jQuery做到这一点的
,然后您需要的只是一个“活跃”类,以应用所需的悬停效果。
这是工作的小提琴:
”
As far as i'm aware this isn't possible with pure CSS with your markup.
You could use some javascript to achieve this effect relatively easy though. Heres how you could do it with jQuery
And then all you need is an 'active' class to apply the hover effect you want.
Here's the working fiddle:
https://jsfiddle.net/2mduzg4h/37/
Hopefully that helps