Given the following design element, I'm attempting to include the images in html so that the opacity can be manipulated with css transitions (hover effect).
Here's my solution thus far: http://codepen.io/roachdesign/pen/VeQKJK/
The major drawback here is that I'm using a manual vertical centering (absolute / top:40%), which becomes apparent when shrinking the browser.
Is is possible to apply vertical centering with flexbox or tables when working with absolute positioning?
HTML
<div class="badge-container">
<a href="">
<div class="badge">
<img src="http://www.placehold.it/400x400/FF9999">
<h2><strong>Cumberland</strong>County</h2>
</div>
</a>
<a href="">
<div class="badge">
<img src="http://www.placehold.it/400x400/99FF99">
<h2><strong>Dauphin</strong>County</h2>
</div>
</a>
<a href="">
<div class="badge">
<img src="http://www.placehold.it/400x400/9999FF">
<h2><strong>Lancaster</strong>County</h2>
</div>
</a>
<a href="">
<div class="badge">
<img src="http://www.placehold.it/400x400/9F9F99">
<h2><strong>Lebanon</strong>County</h2>
</div>
</a>
<a href="">
<div class="badge">
<img src="http://www.placehold.it/400x400">
<h2><strong>York</strong>County</h2>
</div>
</a>
</div>
SCSS
.badge-container {display:flex; flex-direction:row;
.badge {position:relative;}
h2 {position:absolute;
top:36%;
left:0;
right:0;
text-align:center;
strong {display:block;}
}
}
img {max-width:100%;}