Search
 
SCRIPT & CODE EXAMPLE
 

CSS

custom checkbox

.checkbox-label {
    display: block;
    position: relative;
    margin: auto;
    cursor: pointer;
    font-size: 22px;
    line-height: 24px;
    height: 24px;
    width: 24px;
    clear: both;
}

.checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-label .checkbox-custom {
    position: absolute;
    top: 0px;
    left: 0px;
    height: 24px;
    width: 24px;
    background-color: transparent;
    border-radius: 5px;
    transition: all 0.3s ease-out;
    -webkit-transition: all 0.3s ease-out;
    -moz-transition: all 0.3s ease-out;
    -ms-transition: all 0.3s ease-out;
    -o-transition: all 0.3s ease-out;
    border: 2px solid #000;
}


.checkbox-label input:checked ~ .checkbox-custom {
    background-color: #FFEA00;
    border-radius: 5px;
    -webkit-transform: rotate(0deg) scale(1);
    -ms-transform: rotate(0deg) scale(1);
    transform: rotate(0deg) scale(1);
    opacity:1;
    border: 2px solid #000;
}

.checkbox-label .checkbox-custom::after {
    position: absolute;
    content: "";
    left: 12px;
    top: 12px;
    height: 0px;
    width: 0px;
    border-radius: 5px;
    border: solid #000;
    border-width: 0 3px 3px 0;
    -webkit-transform: rotate(0deg) scale(0);
    -ms-transform: rotate(0deg) scale(0);
    transform: rotate(0deg) scale(0);
    opacity:1;
    transition: all 0.3s ease-out;
    -webkit-transition: all 0.3s ease-out;
    -moz-transition: all 0.3s ease-out;
    -ms-transition: all 0.3s ease-out;
    -o-transition: all 0.3s ease-out;
}


.checkbox-label input:checked ~ .checkbox-custom::after {
  -webkit-transform: rotate(45deg) scale(1);
  -ms-transform: rotate(45deg) scale(1);
  transform: rotate(45deg) scale(1);
  opacity:1;
  left: 8px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid #000000;
  border-width: 0 2px 2px 0;
  background-color: transparent;
  border-radius: 0;
}
Comment

how to create custom checkbox

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Simple check box</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta https-equiv="X-UA-Compatible" content="ie=edge" />
    <link rel="stylesheet" href="style.css" />
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
  </head>
  <body>
    <div class="lang-selector">
      <div class="flex-field">
        <input type="radio" name="lang" value="eng" id="english">
        <label for="english"></label>
        <span class="label">English</span>
      </div>
      <div class="flex-field">
        <input type="radio" name="lang" value="noneng" id="nonenglish">
        <label for="nonenglish"></label>
        <span class="label">Non English</span>
      </div>
    </div>
<style>
* {
  padding: 0; margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}
body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #f1f2f3;
}
input[type="radio"] {
    display: none;
}
input[type="radio"] + label {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 1px solid #4b00ff;
    position: relative;
    cursor: pointer;
}
input[type="radio"] + label:after {
    content: "";
    position: absolute;
    width: 3px;
    height: 12px;
    left: 0;
    right: 0;
    top: 0;
    margin: auto;
    transform: rotate(45deg);
    border: 2px solid #f1f2f3;
    border-top-color: transparent;
    border-left-color: transparent;
}
input[type="radio"]:checked + label {
    background: #4b00ff;
}
.lang-selector,
.flex-field {
    display: flex;
    align-items: center;
    grid-gap: 10px;
}
    </style>
  </body>
</html>
Comment

customize checkbox

appearance:none
outline:2px slid red;
outline-offset:2px // space between ouline and bg color
// if is checked input:checked {backgound-color :red}
border-radius:50%;
Comment

PREVIOUS NEXT
Code Example
Css :: enlarge icon when hover 
Css :: calculadora 
Css :: text width tailwindcss 
Typescript :: npm uninstall typescript 
Typescript :: expected 2 arguments but got 1. viewchild angular 
Typescript :: eliminate dots li 
Typescript :: next js onclick navigate 
Typescript :: benefits eat halim plant leaves 
Typescript :: Listing avaible ports pyserial 
Typescript :: jquery check value exists in array 
Typescript :: Do not use "// @ts-ignore" comments because they suppress compilation errors 
Typescript :: how to check when a number varibal = nan in ts 
Typescript :: font awesome angular 
Typescript :: angular get url param 
Typescript :: tolowercase typescript 
Typescript :: google sheets replace dot with comma 
Typescript :: subplots legend 
Typescript :: serenity.-is add column picker button 
Typescript :: drop the rows where all elements are missing in a pandas dataframe 
Typescript :: Redirects in Odoo Website 
Typescript :: check if string include numbers in typescript 
Typescript :: adonis validator exists 
Typescript :: angular connexion 
Typescript :: session not created: This version of ChromeDriver only supports Chrome version 85 
Typescript :: how to reset stats in diablo 2 
Typescript :: how to view documents folder simulator swift 
Typescript :: simbu type1 
Typescript :: how to get value_counts output in dataframe format 
Typescript :: symfony assets install 
Typescript :: Does not use passive listeners to improve scrolling performance 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =