JSFiddle - React, Tailwind, and code Playground
HTML
<div class="post-thumb">
<a href="http://eclectivism.com/text/">
<span class="post-thumb-highlight"></span>
<h2 class="entry-title">Text text text text text text text text text text text text text text text text text text text text text text text text</h2>
<img src="http://eclectivism.com/wp-content/uploads/2013/09/space-doodle-01-580x7041.jpg" class="attachment-blog-large wp-post-image" />
</a>
</div>
CSS
.post-thumb {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
font-size: 0;
}
a {position: relative; display: inline-block; }
.post-thumb-highlight {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background: rgba(214,238,219,0.8);
opacity: 0;
}
h2 {
opacity: 0;
text-decoration: none;
display: inline-block;
color: #fff;
text-decoration: none;
text-shadow: 0px 1px 5px rgb(63, 97, 56);
text-align:center;
width: 300px; /* same width as IMG */
vertical-align: middle;
margin-right: -300px; /* negative value of IMG width */
position: relative;
font-size: 24px;
}
img {
width: 300px;
vertical-align: middle;
}
a:hover h2, a:hover .post-thumb-highlight {opacity:1}