novice here.
The goal is to show an image on hover that contains text. I got technically what I wanted, when I hover over the 'test' container the image shows. But when I hover over the 'text' area it doesn't show. Any help would be greatly appreciated.
HTML:
<div class="test">
<img class="testimg" src="images/feat-img2.jpg">
<p class="test-text">This is a caption text</p>
</div>
CSS:
.test {
position: relative;
padding: 0;
margin: 0;
width: 100%;
height: 200px;
overflow: hidden;
background: #111111;
}
.test img {
display: block;
max-width: 100%;
height: auto;
opacity: 0;
transition: all 0.3s ease-in-out;
}
.test:hover, .test img:hover {
opacity: 1;
}
.testimg {
width: 100%;
height: auto;
}
.test-text {
display: block;
position: absolute;
width: 100%;
color: #fff;
left: 50%;
bottom: 50%;
padding: 1em;
font-weight: 700;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}