Linebox headings
by phloe
HTML
<div>
<img src="https://psmedia.playstation.com/is/image/psmedia/the-last-guardian-screen-06-ps4-eu-16jun15?$MediaCarousel_Original$"/>
<h3 title="The Last Guardian: 10 years in the making">
<span>The Last Guardian:<br/>10 years in the making</span>
</h3>
</div>
<div>
<img src="https://psmedia.playstation.com/is/image/psmedia/the-last-guardian-screen-06-ps4-eu-16jun15?$MediaCarousel_Original$"/>
<h3>
<span>The Last Guardian:<br/>10 years in the making</span>
<span aria-hidden="true">The Last Guardian:<br/>10 years in the making</span>
</h3>
</div>
CSS
div {
position: relative;
_width: 50%;
background-color: limegreen;
}
div:after {
content: "";
display: block;
padding-bottom: 56.25%;
}
div > img {
position: absolute;
width: 100%;
height: auto;
top: 0;
left: 0;
}
div > h3 {
font: 6.944444444444445vw/1 sans-serif;
color: #FFF;
position: absolute;
bottom: .6em;
left: .6em;
padding: 0;
margin: 0;
max-width: 65%;
}
div > h3 > span, div > h3:after {
position: absolute;
z-index: 1;
bottom: -.1em;
left: 0;
display: inline;
padding: .1em 0;
margin: 0;
}
div > h3:after {
content: attr(title);
white-space: pre-wrap;
}
div > h3 > [aria-hidden], div > h3:after {
position: relative;
z-index: 0;
bottom: auto;
left: auto;
opacity: 0.75;
color: transparent;
background-color: #000;
box-shadow: .2em 0 0 #000, -.2em 0 0 #000;
box-decoration-break: clone;
}
@media (min-width: 720px) {
div > h3 {
font-size: 50px;
}
}