3 divs — two are changed by one hover css

守給你的承諾、 提交于 2019-12-25 07:34:01

问题


I have 3 divs

in this order 1 - 2 - 3

I want to change the background of 1 & 3 when I hover over 2 (using css)

so far only div 3 will change


回答1:


Use the classes to style them on hover in your CSS. Example:

<div class="one"> First </div>
<div class="two"> Second </div>
<div class="three"> Third </div>



.one:hover, .three:hover {
 background: pink; 
 }


来源:https://stackoverflow.com/questions/16628273/3-divs-two-are-changed-by-one-hover-css

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!