0

So according to this Link

I should be able to hide a div with CSS and appear on hover but for some reason I'm not getting the same hover effect on the image I put it on which happens to be on the top corner of this Link

Any suggestion on why it might now be working?

Here's the CSS I used

.user-image {
  float:none !important;
  right: 0;
  margin-right: 4.5%;
  position: absolute;
  z-index: 100;
}

.user-image img {
  width: 65px !important;
  height: 65px !important;
  margin-top: -15px;
  border: 2px solid white;
  border-radius: 32px;
}

.user-image li {
  list-style: none;
  background-color: white;
  display: none;
  padding: 10px;
  width: 100px;
  margin-left: -35px; 
}

.user-image img:hover + .user-image li {
  display: block;
}

Here's the HTML

<div class="user-image">
<img src="http://chocobento.x10.mx/wp/wp-content/uploads/2015/09/1-300x300.jpg" width="180" height="180" alt="itslino" class="avatar avatar-180 wp-user-avatar wp-user-avatar-180 alignnone photo">
<li> Test </li>
<li> Test 2 </li>
</div>
Community
  • 1
  • 1

3 Answers3

1

This won't work:

.user-image img:hover + .user-image li {
  display: block;
}

You're selecting any li that is a descendant of a .user-image, that is a sibling of an img:hover that is a descendant of a .user-image.

I can't give you an actual solution because we need to see the html that's being returned by your php tag, but if your img is inside of the li that's hidden, then you should hide/show when the li is hovered, not the img.


Update

Based on the html you provided, you just need to drop the second .user-image from your selector:

.user-image img:hover + li {
  display: block;
}
Shawn Erquhart
  • 1,820
  • 2
  • 17
  • 30
1

you can use opacity to accomplish this like the example below

.user-image {
    opacity: 0;
    background-color: red;
}
.user-image:hover {
    opacity: 1;
}
<div class="user-image">
    <a href="">Test hover thing here</a>
</div>
indubitablee
  • 8,136
  • 2
  • 25
  • 49
0

Make some changes to your code something like this way

replace your code with this codes.

    <div class="user-image">
    <a><img  src="http://chocobento.x10.mx/wp/wp-content/uploads/2015/09/1-300x300.jpg" width="180" height="180" alt="itslino" class="avatar avatar-180 wp-user-avatar wp-user-avatar-180 alignnone photo"></a>
    <div class="user-image">
        <li> Test </li>
        <li>Test 2 </li>
    </div>

and style

a:hover + .user-image li  {
display: block;
}

CLICK HERE TO SEE YOUR CODE IN FIDDLE

Make adequate changes if necessary..

gud luck