You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

汉堡切换按钮Hover时仅单条改变的问题修复求助

Fixing Hamburger Toggle Button Hover Sync Issue

Hey there! I see the problem with your hamburger menu—right now, only the individual bar you hover over changes color, but you want all three to sync up when you hover anywhere on the toggle button. Let's fix that quickly.

What's Causing the Issue?

Your current CSS targets .toggle-button .bar:hover, which only applies the color change to the specific bar your mouse is directly over. Instead, we need to trigger the color change for all bars when the entire toggle button container is hovered.

Updated CSS Solution

Replace your bar hover rule with this one, and keep the rest of your CSS as is:

.toggle-button:hover .bar {
  background-color: black;
}

Full Modified CSS

Here's the complete CSS with the fix included:

.toggle-button {
 border: 1px solid grey;
 border-radius: 5px;
 cursor: pointer;
 display: inline-block;
 height: fit-content;
 transition: all 0.5s ease;
}
.toggle-button:hover {
 background-color: black;
}
.toggle-button .bar {
 background-color: grey;
 border-radius: 2.5px;
 margin: 4px;
 height: 4px;
 width: 25px;
}
/* This is the updated rule */
.toggle-button:hover .bar {
 background-color: black;
}

How It Works

The selector .toggle-button:hover .bar means: "When the .toggle-button is being hovered, apply this style to all its child .bar elements." Now, whenever you hover anywhere on the toggle button (even the space between bars), all three bars will switch to black at the same time, matching the button's background change perfectly.

内容的提问来源于stack exchange,提问作者Daniel Zhang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 15:37:34