1 回答
TA贡献1886条经验 获得超2个赞
考虑悬停在父元素上
body {
background: #000;
}
div {
counter-reset: btn;
display: flex;
flex-flow: row wrap;
max-width: 200px;
}
button {
flex: 0 0 20%;
display: block;
height: 30px;
border: 0;
background-color: #333;
color: #fff;
border: 1px solid #000;;
}
button:before {
counter-increment: btn;
content: counter(btn);
}
button[value="selected_first"] {
background: green !important;
}
div:hover button[value="selected_first"] ~ button,
div:hover button:hover {
background: blue;
}
div:hover button:hover ~ button {
background: #333;
}
<div>
<button></button>
<button></button>
<button value="selected_first"></button>
<button></button>
<button></button>
<button></button>
<button></button>
<button></button>
<button></button>
<button></button>
</div>
- 1 回答
- 0 关注
- 78 浏览
添加回答
举报