<div class="form-group">
<label class="custom-radio">
<input type="radio" name="option" value="1" checked>
<span class="radio-style"></span> Option One
</label>
<label class="custom-radio">
<input type="radio" name="option" value="2">
<span class="radio-style"></span> Option Two
</label>
</div>body {
font-family: Arial, sans-serif;
padding: 20px;
background-color: #f0f0f0;
display: flex; justify-content: center; align-items: center; min-height: 100vh;
}
.form-group {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.custom-radio {
display: block;
position: relative;
padding-left: 30px;
margin-bottom: 12px;
cursor: pointer;
font-size: 16px;
user-select: none;
color: #333;
}
/* Hide the browser's default radio button */
.custom-radio input[type="radio"] {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
/* Create a custom radio button */
.radio-style {
position: absolute;
top: 0;
left: 0;
height: 20px;
width: 20px;
background-color: #eee;
border: 1px solid #ccc;
border-radius: 50%;
transition: background-color 0.2s ease;
}
/* On mouse-over, add a grey background color */
.custom-radio:hover input ~ .radio-style {
background-color: #ddd;
}
/* When the radio button is checked, add a blue background */
.custom-radio input:checked ~ .radio-style {
background-color: #2196F3;
border-color: #2196F3;
}
/* Create the indicator (the dot/circle - hidden when not checked) */
.radio-style:after {
content: "";
position: absolute;
display: none;
}
/* Show the indicator (dot/circle) when checked */
.custom-radio input:checked ~ .radio-style:after {
display: block;
}
/* Style the indicator (dot/circle) */
.custom-radio .radio-style:after {
top: 6px;
left: 6px;
width: 8px;
height: 8px;
border-radius: 50%;
background: white;
}Nothing to show yetType HTML, CSS or JavaScript and your page appears here.
Click any element to find its code Esc
Check this code before you run it
It came from a shared link. It runs with fewer permissions, so it cannot open pop-ups, submit forms or start downloads.
0.00s / 0.00s
Nothing has animated yet. Hover, click or type in the preview and each CSS animation, transition or
element.animate() call shows up here as it plays.