<main>
<input type="radio" name="cover" id="last-shot" checked />
<input type="radio" name="cover" id="mu" />
<input type="radio" name="cover" id="celtic" />
<input type="radio" name="cover" id="blank" />
<book></book>
<labels>
<label for="last-shot">The Last Shot</label>
<label for="mu">The Lost City of Mū</label>
<label for="celtic">Celtic Tales</label>
<label for="blank">No cover</label>
<p>This experiment was based on <a href="https://books.apple.com/ie/book/corto-malt%C3%A9s-m%C5%AB-el-continente-perdido/id1325824788">Apple Books</a> which uses PNG image overlays to create the effect.</p>
</labels>
</main>
book {
$book-width: 40vmin;
$bit: $book-width / 160;
position: relative;
background: {
color: white;
size: cover;
}
box-shadow:
#{$bit / 2} #{$bit / 2} #{$bit * 2} rgba(black, 0.3),
$bit $bit #{$bit * 4} rgba(black, 0.3),
#{$bit * 4} #{$bit * 5} #{$bit * 10} rgba(black, 0.4);
&, &::after {
display: block;
width: $book-width;
height: #{$book-width * 1.5};
border-radius: #{$bit * 2};
}
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
box-shadow:
-#{$bit / 2} -#{$bit} #{$bit * 2} rgba(black, 0.2) inset,
-#{$bit / 2} -#{$bit / 2} $bit rgba(black, 0.2) inset;
background-image:
linear-gradient(
to bottom,
rgba(white, 0.1),
rgba(black, 0.2)
),
linear-gradient(
to right,
rgba(black, 0.2) 0,
rgba(black, 0) #{$bit * 2},
rgba(black, 0.2) #{$bit * 4},
rgba(black, 0) #{$bit * 5}
);
}
#mu:checked ~ & { background-image: url("https://is1-ssl.mzstatic.com/image/thumb/Publication4/v4/8d/4f/76/8d4f7649-69a6-1701-dd26-0c34e19488ac/front_cover.jpg/292x0w.jpg"); }
#celtic:checked ~ & { background-image: url("https://is2-ssl.mzstatic.com/image/thumb/Publication/v4/f9/be/d8/f9bed8b7-e8ce-f1c2-b020-84a9ed10dcc2/front_cover.jpg/292x0w.jpg"); }
#last-shot:checked ~ & { background-image: url("https://images-na.ssl-images-amazon.com/images/I/51EU6mhQT1L.jpg"); }
#blank:checked ~ & { background-image: none; }
}
// ------ all other stylings ------
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: linen;
font: {
family: sans-serif;
size: 2.4vmin;
weight: 100;
}
color: #5f5846;
}
main {
display: flex;
}
input {
position: fixed;
top: -999px;
left: -999px;
}
labels {
width: 18em;
}
label {
display: block;
margin: 0.5rem;
padding: 2vmin;
font: {
family: sans-serif;
size: 1.5em;
}
&::before {
content: "Hugo Pratt";
display: block;
opacity: 0.7;
font-size: 60%;
line-height: 1em;
text-transform: uppercase;
}
&:nth-child(4)::before {
content: none;
}
#last-shot:checked ~ labels &[for="last-shot"],
#mu:checked ~ labels &[for="mu"],
#celtic:checked ~ labels &[for="celtic"],
#blank:checked ~ labels &[for="blank"] {
background-color: #5f5846;
color: white;
}
}
p {
padding: 2vmin;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.