<div class="radio">
<input label="Yes" type="radio" id="male" name="gender" value="male" checked>
<input label="No" type="radio" id="female" name="gender" value="female">
<input label="I hate making decisions 🤷🏻♂️" type="radio" id="other" name="gender" value="other">
</div>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.radio {
background: #454857;
padding: 4px;
border-radius: 3px;
box-shadow: inset 0 0 0 3px rgba(35, 33, 45, 0.3),
0 0 0 3px rgba(185, 185, 185, 0.3);
position: relative;
}
.radio input {
width: auto;
height: 100%;
appearance: none;
appearance: none;
appearance: none;
outline: none;
cursor: pointer;
border-radius: 2px;
padding: 4px 8px;
background: #454857;
color: #bdbdbdbd;
font-size: 14px;
font-family: system-ui, system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
transition: all 100ms linear;
}
.radio input:checked {
background-image: linear-gradient(180deg, #95d891, #74bbad);
color: #fff;
box-shadow: 0 1px 1px #0000002e;
text-shadow: 0 1px 0px #79485f7a;
}
.radio input:before {
content: attr(label);
display: inline-block;
text-align: center;
width: 100%;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.