galaxy/Radio-buttons/Pradeepsaranbishnoi_wet-dragonfly-79.html

66 lines
1.3 KiB
HTML

<label class="radio-button">
<input type="radio" name="example-radio" value="option1">
<span class="radio"></span>
Option 1
</label>
<label class="radio-button">
<input type="radio" name="example-radio" value="option2">
<span class="radio"></span>
Option 2
</label>
<style>
/* From Uiverse.io by Pradeepsaranbishnoi - Tags: radio */
.radio-button {
display: flex;
gap: 10px;
justify-content: center;
margin: 10px;
position: relative;
align-items: center;
color: white;
}
.radio-button input[type="radio"] {
position: absolute;
opacity: 0;
}
.radio {
position: relative;
display: inline-block;
width: 24px;
height: 24px;
border-radius: 50%;
border: 2px solid #ccc;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
transform: translateZ(-25px);
transition: all 0.3s ease-in-out;
}
.radio::before {
position: absolute;
content: '';
width: 10px;
height: 10px;
top: 5px;
left: 5px;
border-radius: 50%;
background-color: #fff;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
opacity: 0;
transition: all 0.3s ease-in-out;
}
.radio-button input[type="radio"]:checked + .radio {
border-color: #5cb85c;
transform: translateZ(0px);
background-color: #fff;
}
.radio-button input[type="radio"]:checked + .radio::before {
opacity: 1;
}
</style>