0

I have a span on an image which I hide using display:none. Trying to show it with display:block on hover is not working. Can any one help me?

.imagegood {
  position: absolute;
  top: 200px;
  background-color: white;
  color: black;
  padding: 10px;
  font-size: large;
  display: none;
}
.ShowHidden:hover {
  display: block !important;
}
<div style="position:relative; text-align:center;margin-top: 10px; padding-right: 0px; padding-left: 0px;" class="col-sm-6 col-md-6 col-lg-4 text-center ">
  <a class="ShowHidden" href="#">
    <div>
      <img style="width:100% ; height:auto;" class="img-responsive center-block" src="http://media02.hongkiat.com/ww-flower-wallpapers/roundflower.jpg" />
      <span class="imagegood">GoodTitle</span>
    </div>


  </a>
  <h3 style="font-weight:bold;" class="h">GoodTitle</h3>
  <h5 class="h">GoodSubText</h5>
</div>
Bowdzone
  • 3,827
  • 11
  • 39
  • 52
shm
  • 439
  • 2
  • 11
  • 25

5 Answers5

1

Used to this

.ShowHidden:hover .imagegood{
    display:inline-block ;
}

Demo

Code

.imagegood{
    position: absolute;
    top: 200px;
    background-color:white;
    color:black;
    padding:10px;
    font-size:large;
    display:none;
}
.ShowHidden:hover  .imagegood{
    display:inline-block ;
}
<div  style="position:relative; text-align:center;margin-top: 10px; padding-right: 0px; padding-left: 0px;" class="col-sm-6 col-md-6 col-lg-4 text-center ">
            <a class="ShowHidden" href="#">
                <div>
                    <img style="width:100% ; height:auto;" class="img-responsive center-block" src="http://media02.hongkiat.com/ww-flower-wallpapers/roundflower.jpg" />
                    <span class="imagegood">GoodTitle</span>
                </div>
                

            </a>
                <h3 style="font-weight:bold;" class="h">GoodTitle</h3>
            <h5 class="h">GoodSubText</h5>
        </div>
Rohit Azad Malik
  • 31,410
  • 17
  • 69
  • 97
1

Consider following

.ShowHidden:hover .imagegood{
    display:block;
}

.imagegood{
position: absolute;
top: 100px;
background-color:white;
color:black;
padding:10px;
font-size:large;
transition: 1s all;
opacity: 0;
}
.ShowHidden:hover .imagegood{
    opacity: 1;
}
<div  style="position:relative; text-align:center;margin-top: 10px; padding-right: 0px; padding-left: 0px;" class="col-sm-6 col-md-6 col-lg-4 text-center ">
        <a class="ShowHidden" href="#">
            <div>
                <img style="width:100% ; height:auto;" class="img-responsive center-block" src="http://media02.hongkiat.com/ww-flower-wallpapers/roundflower.jpg" />
                <span class="imagegood">GoodTitle</span>
            </div>


        </a>
            <h3 style="font-weight:bold;" class="h">GoodTitle</h3>
        <h5 class="h">GoodSubText</h5>
Manwal
  • 23,450
  • 12
  • 63
  • 93
1

What I think you should try is visibility: hidden; vs display: none;

display: none; removes it from the page - you can still interact with it in the dev tools, but can't see it where as visibility: hidden has allocated dom space.

see this answer here

Community
  • 1
  • 1
richessler
  • 84
  • 6
1

Answer is already given but for your understanding :

If you want to hide and show any element then target that element too like you hide the span so on hove use span also like this .ShowHidden:hover span

If you are hiding div then use div instead of span or you can use class/id name also.

Working Demo

Leo the lion
  • 3,164
  • 2
  • 22
  • 40
0

Why not use JQuery

$(".imagegood")..mouseover(function() {
 $( ".center-block").fadeIn();
});

you can even have it popup for 3sec

 $( ".center-block").fadeIn().delay(3000).fadeOut();

take a look at this link http://api.jquery.com/fadein/