Stylish Radio Button - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Stylish Radio Button</title> <style> body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: #f5f5f5; } .radio-group { display: flex; gap: 20px; } .radio { display: none; } .radio-label { position: relative; display: flex; align-items: center; cursor: pointer; font-size: 18px; padding-left: 40px; transition: color 0.3s; } .radio-label:before, .radio-label:after { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; transition: background-color 0.3s, box-shadow 0.3s; } .radio-label:before { background: #e0e0e0; box-shadow: inset 0 0 0 2px #999; } .radio:checked + .radio-label:before { background: #4caf50; box-shadow: inset 0 0 0 2px #4caf50; } .radio:checked + .radio-label:after { background: url('https://twemoji.maxcdn.com/v/13.0.1/72x72/1f44d.png') no-repeat center center; background-size: cover; } .radio:checked + .radio-label { color: #4caf50; } .radio-label span { margin-left: 10px; } @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); } 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); } } .radio:checked + .radio-label:before { animation: pulse 1s infinite; } </style> </head> <body> <div class="radio-group"> <input type="radio" id="radio1" name="radios" class="radio" checked> <label for="radio1" class="radio-label"> <i class="fas fa-music"></i> <span>Option 1</span> </label> <input type="radio" id="radio2" name="radios" class="radio"> <label for="radio2" class="radio-label"> <i class="fas fa-film"></i> <span>Option 2</span> </label> <input type="radio" id="radio3" name="radios" class="radio"> <label for="radio3" class="radio-label"> <i class="fas fa-book"></i> <span>Option 3</span> </label> </div> <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> </body> </html>