如何隐藏/显示图标:悬停

时间:2015-03-31 08:52:08

标签: css twitter-bootstrap

这正是我想要做的 enter image description here

这是我的代码

img.info-societe {
    cursor: pointer;
    display: none;
}
img.info-societe:hover {
    display: inline;
}

为什么不起作用?什么是最好的解决方案?

2 个答案:

答案 0 :(得分:7)

我认为你需要这样的东西:

tr {
  cursor: pointer;
}

tr img.info-societe {
  display: none;
}

tr:hover img.info-societe {
  display: inline-block;
}

答案 1 :(得分:5)

您应该使用opacity属性而不是显示。

img.info-societe {
   cursor: pointer;
   opacity: 0;
}
img.info-societe:hover {
   opacity: 1;
}
相关问题