100-project-100-days-website/100_projects/18-customize-radio-input/style.css
2023-03-11 08:42:17 +03:00
Ask

64 lines
1.2 KiB
CSS

{16e5cff2027437c5e18eed020ca0bd9d3c0b4c7e true 1253 style.css 0xc001e58cb0}

* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #B6D6C8;
color: #2C2D2A;
}
form {
width: 350px;
margin: 20px auto;
background-color: #f9f9f9;
padding: 25px 30px;
border-radius: 5px;
font-size: 21px;
}
form > div {
padding: 5px 0;
}
form input[type="radio"] {
-webkit-appearance: none;
appearance: none;
}
form label {
position: relative;
padding-left: 25px;
}
form label::before {
content: "";
width: 16px;
height: 16px;
border: 1px solid #2C2D2A;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
background: white;
border-radius: 50%;
}
form input[type="radio"]:checked + label::after,
form input[type="radio"]:not(:checked):hover + label::after {
content: "";
background-color: #2C2D2A;
width: 10px;
height: 10px;
position: absolute;
left: 4px;
top: 7px;
border-radius: 5px;
}
form input[type="radio"]:not(:checked):hover + label::after {
opacity: 0.2;
}
form input[type="radio"]:checked + label {
color: #2C2D2A;
padding: 0 30px;
background-color: #B6D6C8;
border-radius: 5px;
}