【发布时间】:2014-12-24 02:16:19
【问题描述】:
我有一堆 if <a> 标签,这些标签具有与之关联的唯一 ID,以及 <img> 的子元素。我希望默认隐藏图像(display:none),并在您将鼠标悬停在它们所属的<a> 标签上时使其可见。但是,目前当我在我的 css 中使用 #a-tag-id:hover 选择器尝试此行为时,图像在悬停时不会变得可见。
不太确定我做错了什么。
这是一个具有相同行为的小提琴。
http://jsfiddle.net/ebbnormal/bobmrud0/1/
这里是原始的haml/css:
#map
%a#saddleback_point
=image_tag('saddleback_college.png', width:'300px')
%a#citrus_point
=image_tag('citrus_college.png', width:'300px')
%a#sonrise_point
=image_tag('sonrise.png', width:'300px')
%a#vegas_point
=image_tag('vegas.png', width:'300px')
%a#tennessee_point
=image_tag('tennessee.png', width:'300px')
%a#chestnut_point
=image_tag('chestnut.png', width:'300px')
%a#saint_point
=image_tag('saint.png', width:'300px')
%a#boston_point
=image_tag('boston.png', width:'300px')
%a#fisher_point
=image_tag('fisher.png', width:'300px')
#citrus_point img{
top:360px;
bottom:0px;
left:240px;
position:absolute;
display:none; //TODO This is broken!
}
#citrus_point:hover img{
display:block;
}
【问题讨论】:
-
您知道
//不是有效的CSS 注释语法吗?如果您将某些内容设置为显示:无,如果未显示,悬停将如何触发? -
@j08691 很遗憾,我不知道。现在我愿意。我更新了小提琴。谢谢!
标签: css