Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Titre du document</title> <style> div { margin: 10px; font-size: 20px; } input:checked + label { color: #000; } input[type="radio"]:checked { box-shadow: 0 0 0 4px #8ebf42; } /* Élément de case à cocher */ input[type="checkbox"]:checked { box-shadow: 0 0 0 3px #1c87c9; } </style> </head> <body> <h2>Exemple de sélecteur :checked</h2> <div> <input type="radio" name="my-input" id="yes"> <label for="yes">Yes</label> <input type="radio" name="my-input" id="no"> <label for="no">No</label> </div> <div> <input type="checkbox" name="my-checkbox" id="opt-in"> <label for="opt-in">Check!</label> </div> </body> </html>