Search
 
SCRIPT & CODE EXAMPLE
 

CSS

styling radio input

input:where([type="checkbox"], [type="radio"]){
  -webkit-appearance : none;
  appearance         : none;
  width              : 22px;
  height             : 22px;
  margin             : calc(0.75em - 11px) 0.25rem 0 0;
  vertical-align     : top;
  border             : 2px solid #ddd;
  border-radius      : 4px;
  background         : #fff no-repeat center center;
}

input[type="radio"]{
  border-radius : 50%;
}

input:where([type="checkbox"], [type="radio"]):where(:active:not(:disabled), :focus){
  border-color : #696;
  outline      : none;
}

input:where([type="checkbox"], [type="radio"]):disabled{
  background : #eee;
}

input[type="checkbox"]:checked{
  background-image : url('checkbox.svg');
}

input[type="radio"]:checked{
  background-image : url('radio.svg');
}
Comment

custom radio css

<label class="container">One
  <input type="checkbox" checked="checked">
  <span class="checkmark"></span>
</label>

<label class="container">Two
  <input type="checkbox">
  <span class="checkmark"></span>
</label>

<label class="container">Three
  <input type="checkbox">
  <span class="checkmark"></span>
</label>

<label class="container">Four
  <input type="checkbox">
  <span class="checkmark"></span>
</label>

<style>
/* The container */
.container {
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: 12px;
  cursor: pointer;
  font-size: 22px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hide the browser's default checkbox */
.container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

/* Create a custom checkbox */
.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 25px;
  width: 25px;
  background-color: #eee;
}

/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
  background-color: #ccc;
}

/* When the checkbox is checked, add a blue background */
.container input:checked ~ .checkmark {
  background-color: #2196F3;
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
  display: block;
}

/* Style the checkmark/indicator */
.container .checkmark:after {
  left: 9px;
  top: 5px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 3px 3px 0;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}
</style>
Comment

PREVIOUS NEXT
Code Example
Css :: how to add a class to a paragraph in css 
Css :: remove accordion space materuail ui css 
Css :: how to scale down background image in css 
Css :: how to make a triangle in css 
Css :: css blur 
Css :: bootstrap modal is grayed out 
Css :: text area focus css 
Css :: crop img css 
Css :: import css in another css file 
Css :: make button stretch to fit text 
Css :: var minus scss 
Css :: how to add fade-in with page transition 
Css :: border-radius cross browser 
Css :: how to move text down in css 
Css :: how to add image with url in css 
Css :: change bootstrap input focus glow 
Css :: can we use material ui and tailwind css together 
Css :: how to wrap the data in table material UI 
Css :: text overflow ellipsis 
Css :: how to make div width auto adjust 
Css :: css blink animation 
Css :: how to add a background color in css 
Css :: sass loops 
Css :: select2 hide selected options 
Css :: how to set image size without changing aspect ratio in css 
Css :: scroll bar with 0 width 
Css :: how to add outline to text in css 
Css :: word break css 
Css :: css gradient 3 color 
Css :: Timeout for a fetch 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =