codepens/radio-button-group-with-gra.../dist/style.css

74 lines
1.5 KiB
CSS

@charset "UTF-8";
* {
margin: 0;
font: inherit;
}
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
font: 500 calc(.575rem + .575vw)/2 Helvetica Neue, Helvetica, Arial, sans-serif;
}
@media (min-width: 1200px) {
body {
font-size: 1.125rem;
}
}
h2 {
width: 100%;
font-size: 2em;
text-align: center;
}
radiogroup {
display: flex;
overflow: hidden;
width: 97.5%;
min-width: 800px;
max-width: 1200px;
border-radius: 2.5em;
background: linear-gradient(var(--a, 100deg), #0ef49b, #d2dc69 30%, #faa04b 70%, #ff5a64);
}
@media (max-width: 800px) {
radiogroup {
flex-direction: column;
min-width: 12.5rem;
width: 47%;
--a: 170deg;
font-size: 0.875rem;
}
}
input[type='radio'] {
position: absolute;
left: -100vw;
}
input[type='radio'] + label {
flex: 1;
height: 5em;
font-weight: 700;
line-height: 5em;
text-align: center;
text-transform: capitalize;
cursor: pointer;
}
input[type='radio'] + label:after {
display: inline-block;
transform: scale(0);
filter: brightness(0.1);
transition: margin 0.25s cubic-bezier(0.6, -0.28, 0.735, 0.045) 0.1s, transform 0.25s cubic-bezier(0.895, 0.03, 0.685, 0.22);
content: "✔";
}
input[type='radio']:checked + label {
box-shadow: inset 0px 10px 50px rgba(25, 25, 25, 0.1);
}
input[type='radio']:checked + label:after {
margin-left: .75em;
transform: scale(1.25);
transition: margin 0.5s, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.25s;
}