Last active
December 5, 2020 09:55
-
-
Save kumarasinghe/f62588d67b4a43871057feaa3ac96899 to your computer and use it in GitHub Desktop.
Minimal HTML CSS Switch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.switch input{ | |
display: none; | |
} | |
.switch label{ | |
background-color: grey; | |
} | |
.switch input:checked + label{ | |
background-color: red; | |
} | |
</style> | |
<div class="switch"> | |
<input type="radio" name="fruits" id="apple" checked/> | |
<label for="apple">Apple</label> | |
<input type="radio" name="fruits" id="banana"/> | |
<label for="banana">Banana</label> | |
<input type="radio" name="fruits" id="orange"/> | |
<label for="orange">Orange</label> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment