switching/css/carousel.css

121 lines
1.8 KiB
CSS
Raw Normal View History

2020-02-17 14:53:17 +00:00
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
overflow: hidden;
}
label {
background: #444;
color: #fff;
transition: transform 400ms ease-out;
display: inline-block;
min-height: 100%;
width: 100vw;
height: 100vh;
position: relative;
z-index: 1;
text-align: center;
line-height: 100vh;
}
form {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
white-space: nowrap;
}
input {
position: absolute;
}
.keys {
position: fixed;
z-index: 10;
bottom: 0;
left: 0;
right: 0;
padding: 1rem;
color: #fff;
text-align: center;
transition: all 300ms linear;
opacity: 0;
}
input:focus ~ .keys {
opacity: 0.8;
}
input:nth-of-type(1):checked ~ label:nth-of-type(1),
input:nth-of-type(2):checked ~ label:nth-of-type(2),
input:nth-of-type(3):checked ~ label:nth-of-type(3),
input:nth-of-type(4):checked ~ label:nth-of-type(4){
z-index: 0;
}
input:nth-of-type(1):checked ~ label {
transform: translate3d(0, 0, 0);
}
input:nth-of-type(2):checked ~ label {
transform: translate3d(-100%, 0, 0);
}
input:nth-of-type(3):checked ~ label {
transform: translate3d(-200%, 0, 0);
}
input:nth-of-type(4):checked ~ label {
transform: translate3d(-300%, 0, 0);
}
label {
background: #444;
background-size: cover;
font-size: 3rem;
}
label[for="diamonds"],
label[for="hearts"] {
background: #cc0000;
}
label:before,
label:after {
color: white;
display: block;
background: rgba(255,255,255,0.2);
position: absolute;
padding: 1rem;
font-size: 3rem;
height: 10rem;
vertical-align: middle;
line-height: 10rem;
top: 50%;
transform: translate3d(0, -50%, 0);
cursor: pointer;
}
label:before {
content: "\276D";
right: 100%;
border-top-left-radius: 50%;
border-bottom-left-radius: 50%;
}
label:after {
content: "\276C";
left: 100%;
border-top-right-radius: 50%;
border-bottom-right-radius: 50%;
}