JSFiddle - React, Tailwind, and code Playground
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=DM+Sans:400,500,700&display=swap">
<link rel="stylesheet" href="styles.css">
<style>
* {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
padding: 30px 10px;
font-family: 'DM Sans', sans-serif;
transition: background .4s ease-in;
background-color: #c394f8;
}
body.blue {
background-color: #428aa6;
}
input[type=radio] {
display: none;
}
.card {
position: absolute;
width: 60%;
height: 100%;
left: 0;
right: 0;
margin: auto;
transition: transform .4s ease;
cursor: pointer;
}
.container {
width: 100%;
max-width: 800px;
max-height: 800px;
height: 100%;
transform-style: preserve-3d;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.cards {
position: relative;
width: 100%;
height: 100%;
margin-bottom: 20px;
}
img {
width: 100%;
height: 100%;
border-radius: 10px;
object-fit: contain;
}
#item-1:checked ~ .cards #song-3,
#item-2:checked ~ .cards #song-1,
#item-3:checked ~ .cards #song-2 {
transform: translateX(-40%) scale(0.8);
opacity: 0.4;
z-index: 0;
}
#item-1:checked ~ .cards #song-2,
#item-2:checked ~ .cards #song-3,
#item-3:checked ~ .cards #song-1 {
transform: translateX(40%) scale(0.8);
opacity: 0.4;
z-index: 0;
}
#item-1:checked ~ .cards #song-1,
#item-2:checked ~ .cards #song-2,
#item-3:checked ~ .cards #song-3 {
transform: translateX(0) scale(1);
opacity: 1;
z-index: 1;
img {
box-shadow: 0px 0px 5px 0px rgba(81, 81, 81, 0.47);
}
}
.player {
background-color: #fff;
border-radius: 8px;
min-width: 320px;
padding: 16px 10px;
}
.upper-part {
position: relative;
display: flex;
...