CSS Neon Light Checkbox

02/22/2022

Contents

Demo

Full Screen

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Neon Light Checkbox</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <form class="form">
        <input id="checkbox" type="checkbox" name="checkbox">
        <label class="checkbox" for="checkbox">Checkbox</label>
      </form>
      <p>CSS Neon Light</p>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #000;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 30px 15px;
}
input[type=checkbox] {
  display: none;
}
.checkbox {
  position: relative;
  padding: 1px 0 1px 55px;
  color: #fff;
  font-size: 32px;
  letter-spacing: 2px;
  cursor: pointer;
}
.checkbox::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 35px;
  height: 35px;
  border: 3px solid #fff;
  border-radius: 4px;
  content: '';
}
.checkbox::after {
  opacity: 0;
  position: absolute;
  top: 6px;
  left: 15px;
  transform: rotate(45deg);
  width: 8px;
  height: 18px;
  border-right: 3px solid #FFF;
  border-bottom: 3px solid #FFF;
  filter: drop-shadow(2px 2px 2px #ff178f) drop-shadow(-2px -2px 2px #ff178f);
  content: '';
}
input[type=checkbox]:checked + .checkbox {
  text-shadow: 2px 2px 8px #ff178f,
              -2px -2px 8px #ff178f,
              4px 4px 10px #ff178f,
              -4px -4px 10px #ff178f;
}
input[type=checkbox]:checked + .checkbox::before {
  box-shadow: 1px 1px 10px #ff178f,
              -1px -1px 10px #ff178f,
              inset 1px 1px 10px #ff178f,
              inset -1px -1px 10px #ff178f;
}
input[type=checkbox]:checked + .checkbox::after {
  opacity: 1;
}
p {
  margin-top: 15px;
  text-shadow: 2px 2px 10px #ff178f,
              -2px -2px 10px #ff178f;
  color: #fff;
  font-size: 1.5rem;
  letter-spacing: 2px;
}