Skip to content

Instantly share code, notes, and snippets.

@jdspiral
Created June 6, 2024 13:37
Show Gist options
  • Save jdspiral/8e220440049cc663f32ccd5538e3e402 to your computer and use it in GitHub Desktop.
Save jdspiral/8e220440049cc663f32ccd5538e3e402 to your computer and use it in GitHub Desktop.
Custom Radio Button
/* Default color */
input[type="radio"] {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
width: 20px; /* Adjust the size of the radio button */
height: 20px; /* Adjust the size of the radio button */
border-radius: 50%;
border: 2px solid #ccc; /* Change this to the default color */
position: relative;
transition: border-color 0.3s ease;
}
/* Hover color for the center */
input[type="radio"]:hover::before {
content: '';
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 10px; /* Adjust the size of the center */
height: 10px; /* Adjust the size of the center */
background-color: #ff0000; /* Change this to the hover color */
border-radius: 50%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment