Change background of child if parent :hover

戏子无情 提交于 2019-12-01 01:26:55

问题


I want to change the bg-color of .circle.icon if posts-item is hovered. Any idea how to accomplish that, possibly without Javascript?

<div id="scr1" class="large-6 columns timeline">
    <div class="line"></div>
    <ul class="posts">
        <li class="posts-item">
            <div class="circle icon"></div>
             <h2 class="posts-item-title">
                 <a href=""></a>
              </h2>
            <p class="summary"></p>
        </li>
    </ul>
</div>

回答1:


Like so.

.posts-item:hover .circle.icon {
    background: green;
}

No jQuery - Everyone's happy :)



来源:https://stackoverflow.com/questions/18369650/change-background-of-child-if-parent-hover

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