html – 影响div:悬停与另一个div
发布时间:2020-12-30 23:34 所属栏目:34 来源:网络整理
导读:参见英文答案 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/ (编辑:ASP站长网) |
相关内容
网友评论
推荐文章
热点阅读