html – 影响div:悬停与另一个div
发布时间:2020-12-31 13:48:29 所属栏目:资源 来源:网络整理
导读:参见英文答案 How to affect other elements when a div is hovered6个 我正在制作一个画廊,当你将鼠标悬停在主图像上时,缩略图应该变得透明.我想用纯CSS实现这一点,但我不确定这是否可行. CSS: /* should affect thumbs but not main *//* obviously this
参见英文答案 >
How to affect other elements when a div is hovered6个
CSS: /* should affect thumbs but not main */ /* obviously this code wouldn't work */ #main:hover,#thumbs { opacity: .5; } HTML: <div id="main"> Hover over me to change #thumbs </div> <div id="thumbs"> I change when you hover over #main </div> 这可能使用纯CSS吗? 解决方法当然,只需使用相邻的兄弟选择器:#div1:hover + #div2 { ... } 这里有一个例子:http://jsfiddle.net/6BfR6/94/ (编辑:通辽站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |