Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide / show icon with :hover

This is exactly what I want to do enter image description here

And this is my code

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

Why doesn't it work? What's the best solution?

like image 637
Ahmed Ziani Avatar asked Mar 31 '15 08:03

Ahmed Ziani


2 Answers

I think you need something like this:

tr {
  cursor: pointer;
}

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

tr:hover img.info-societe {
  display: inline-block;
}
like image 100
Zakhar Day Avatar answered Oct 04 '22 06:10

Zakhar Day


You should use the opacity property instead of display.

img.info-societe {
   cursor: pointer;
   opacity: 0;
}
img.info-societe:hover {
   opacity: 1;
}
like image 32
cs.matyi Avatar answered Oct 04 '22 07:10

cs.matyi