Every time I attempt to add a hyperlink to the code snippet below, it interferes with the layout of the image and only links the icon rather than the entire flex container. I've experimented with <span>
elements but haven't found a successful solution yet.
.flex-container {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row;
transition: opacity .2s ease-in-out;
flex-wrap: nowrap
}
.flex-item {
text-align: center;
text-decoration: none;
color: #ffffff;
font-family: verdana;
width: 100%;
display: flex;
flex-shrink: 1;
justify-content: center;
align-items: center;
font-size: calc(8px + (26 - 18) * ((100vw - 300px) / (1600 - 300)));
z-index: 10;
flex-wrap: nowrap
}
.flex-item:before {
content: '';
float: left;
padding-top: 100%;
}
.red-box {
background: #fd6f71;
transition: opacity .2s ease-in-out;
opacity: 1;
}
<div class="flex-container">
<div class="red-box flex-item">
<div class="lh-icon"><img src="https://i.imgur.com/NCp8Sst.png"></div>
<a>Placeholder</a>
</div>
</div>
Codepen: