Skip to content

Instantly share code, notes, and snippets.

@motsu0
Last active February 26, 2023 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save motsu0/16b78574a8d113e87d44f6403316c4c2 to your computer and use it in GitHub Desktop.
Save motsu0/16b78574a8d113e87d44f6403316c4c2 to your computer and use it in GitHub Desktop.
css radio button design
.radio-box1{
display: flex;
}
.radio1{
display: none;
}
.label-radio1{
padding: 2px 8px;
border: 1px solid #3498DB;
color: #3498DB;
cursor: pointer;
}
.label-radio1:nth-of-type(n+2){
border-left: none;
}
.radio1:checked + .label-radio1{
background-color: #3498DB;
color: #fff;
}
<div class="radio-box1">
<input class="radio1" name="fruits" id="apple" type="radio" checked>
<label for="apple" class="label-radio1">りんご</label>
<input class="radio1" name="fruits" id="banana" type="radio">
<label for="banana" class="label-radio1">バナナ</label>
<input class="radio1" name="fruits" id="satsuma" type="radio">
<label for="satsuma" class="label-radio1">みかん</label>
<input class="radio1" name="fruits" id="peach" type="radio">
<label for="peach" class="label-radio1">もも</label>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment