Search code examples
htmlcssmousehover

Hovering over image hides the "register here" link


When I mouse hover the image my REGISTER HERE link is getting hidden.

I don't want hover effect on it but i want that link on the same position below the image.

.image {
	position:relative;
	display:inline-block;
	margin:10px;
}
.overlay {
	display:none;
}
.image:hover .overlay {
	width:100%;
	height:100%;
	background:rgba(0,0,0,.5);
	border:10px solid red;
	position:absolute;
	top:0;
	left:0;
	display:inline-block;
	-webkit-box-sizing:border-box;
	-moz-box-sizing:border-box;
	box-sizing:border-box;
	text-align:center;
	color:white;
	padding:12px;
	font-size:20px;
}
img {
	vertical-align:top;
}
<a href="#" class="course">
<div class="image">
	<figure>
	<img  src="http://placekitten.com/250/200"  width="100%" height:"100%">			
 <div class="overlay">Click on the Register Here to know about the:-
		<ul>
			<li>Oracle</li>
			<li>Automated Testing</li>
		</ul>	
	</div>
<figcaption><a href="register.html">Register Here</a></figcaption>
	</figure>
		</div>
	</a>


Solution

  • Added below style -

    .course{
      position: relative;
      display: block;
    }
    

    .image {
      position: relative;
      display: inline-block;
      margin: 10px;
    }
    .overlay {
      display: none;
    }
    .image a:hover .overlay {
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, .5);
      border: 10px solid red;
      position: absolute;
      top: 0;
      left: 0;
      display: inline-block;
      -webkit-box-sizing: border-box;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      text-align: center;
      color: white;
      padding: 12px;
      font-size: 20px;
      pointer-events:none;
    }
    img {
      vertical-align: top;
    }
    .course{
    position: relative;
    display: block;
    }
    <a href="#" class="course">
      <div class="image">
    <figure>
      <img src="http://placekitten.com/250/200" width="100%" height: "100%">
      <div class="overlay">Click on the Register Here to know about the:-
        <ul>
          <li>Oracle</li>
          <li>Automated Testing</li>
        </ul>
      </div>
      <figcaption><a href="register.html">Register Here</a>
      </figcaption>
    </figure>
      </div>
    </a>