Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <style> .radio-container { max-width: 400px; margin: 40px auto; padding: 30px; background-color: #f9f9f9; border-radius: 8px; font-family: sans-serif; } .radio-container h3 { margin-top: 0; } /* The container for each option */ .radio-option { display: block; position: relative; padding-left: 35px; margin-bottom: 12px; cursor: pointer; font-size: 1rem; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* Hide the default radio button but keep it accessible */ .radio-option input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* The custom radio button */ .radiomark { position: absolute; top: 0; left: 0; height: 22px; width: 22px; background-color: #eee; border: 1px solid #ccc; border-radius: 50%; transition: all 0.2s; } /* On mouse-over, add a grey background */ .radio-option:hover .radiomark { background-color: #ccc; } /* When focused with keyboard, show a focus ring */ .radio-option input:focus ~ .radiomark { box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.5); border-color: #007bff; } /* When the radio button is checked, change the border color */ .radio-option input:checked ~ .radiomark { border-color: #007bff; } /* Create the indicator (the dot - hidden when not checked) */ .radiomark:after { content: ""; position: absolute; display: none; } /* Show the indicator when checked */ .radio-option input:checked ~ .radiomark:after { display: block; } /* Style the indicator (the inner dot) */ .radio-option .radiomark:after { top: 5px; left: 5px; width: 12px; height: 12px; border-radius: 50%; background: #007bff; } </style> <div class="radio-container"> <h3>Shipping Method:</h3> <div class="radio-option"> <input type="radio" id="shipping-standard" name="shipping" checked="checked"> <label for="shipping-standard">Standard Shipping (5-7 days)</label> <span class="radiomark"></span> </div> <div class="radio-option"> <input type="radio" id="shipping-express" name="shipping"> <label for="shipping-express">Express Shipping (2-3 days)</label> <span class="radiomark"></span> </div> <div class="radio-option"> <input type="radio" id="shipping-overnight" name="shipping"> <label for="shipping-overnight">Overnight Shipping (1 day)</label> <span class="radiomark"></span> </div> </div>