Currently, when you hover over in image, the opacity gets lighter:
https://jsfiddle.net/vo1npqdx/1268/
This is correct, but now I also want some link text to appear on top of the image as well. I tried to follow the solution in this example:
How to show text on image when hovering?
But when I tried this technique, empty space appears below the image, the text doesn't show up on top, and it isn't centered over the image:
https://jsfiddle.net/vo1npqdx/1269/
I can't seem to figure out how to make the paragraph text appear on top of the box shadow and centered using CSS - any suggestions? If not, then how would this be done with JavaScript? Thank you.
HTML:
<div class="row thumbnail-row">
<div class="my-work-image" id="margin-left-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/hamburger-thumbnail.jpg"/>
<p class="initial-hidden">The Hamburger Collection</p>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/yoyomoi-thumbnail.jpg"/>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/dogs-thumbnail.jpg"/>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/gateway-thumbnail.jpg"/>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/chameleon-thumbnail.jpg"/>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/adrienne-thumbnail.jpg"/>
</div>
<div class="my-work-image">
<img class="thumbnail-image" src="/wp-content/themes/gatewaywebdesign/assets/images/castaway-thumbnail.jpg"/>
</div>
</div><!--end row-->
CSS:
.thumbnail-row {
display: flex;
}
.thumbnail-row div {
position: relative;
}
.thumbnail-row div::after {
content: '';
position: absolute;
top: 0; left: 0;
width: 100%;
height: 100%;
box-shadow: inset 0 0 0 3000px rgba(27,61,88,.5);
}
.thumbnail-image {
display: inline-block;
max-width: 100%;
}
.my-work-image:hover {
opacity: 0.5;
}
/*hidden text*/
.initial-hidden {
visibility: hidden;
text-align: center;
display: inline;
}
.my-work-image:hover .initial-hidden {
visibility: visible;
opacity: 1;
}
@media (max-width: 425px) {
.thumbnail-row {
flex-direction: column;
}
}