Skip to content

Instantly share code, notes, and snippets.

@kumarasinghe
Last active December 5, 2020 09:55
Show Gist options
  • Save kumarasinghe/f62588d67b4a43871057feaa3ac96899 to your computer and use it in GitHub Desktop.
Save kumarasinghe/f62588d67b4a43871057feaa3ac96899 to your computer and use it in GitHub Desktop.
Minimal HTML CSS Switch
<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