Header Ads

Niagahoster

Style Checkboxes with CSS 3

Style Checkboxes with CSS 3

CSS Code

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100%;
  background-color: dodgerblue;
  color: white;
  font-family: Arial;
  font-size: 18px;
}

.title {
  font-family: Verdana;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
}

.form-wrapper {
  padding: 25px;
}
.form-wrapper .option-wrapper {
  margin: 10px 0;
}
.form-wrapper input[type="checkbox"] {
  display: none;
}
.form-wrapper input[type="checkbox"] + label {
  display: inline;
  position: relative;
}
.form-wrapper input[type="checkbox"] + label::before {
  display: inline-block;
  width: 24px;
  height: 24px;
  content: ' ';
  border: 2px solid white;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 15px;
  cursor: pointer;
  z-index: 10;
}
.form-wrapper input[type="checkbox"]:checked + label::before {
  border: 2px solid springgreen;
}
.form-wrapper input[type="checkbox"]:checked + label::after {
  width: 6px;
  height: 16px;
  border: 3px solid springgreen;
  border-left: none;
  border-top: none;
  content: ' ';
  position: absolute;
  left: 10px;
  bottom: 1px;
  transform: rotatez(45deg);
  cursor: pointer;
  z-index: 20;
}
.form-wrapper .btn-submit {
  width: 100px;
  padding: 10px;
  background-color: transparent;
  border: 2px solid white;
  color: white;
  text-align: center;
}
.form-wrapper .btn-submit:hover {
  cursor: pointer;
  border-color: springgreen;
  color: springgreen;
}

HTML Code

<div class="notepad-wrapper">
  <div class="notepad-background"></div>
  <div class="notepad-cover bottom"></div>
  <div class="notepad-papers"></div>
  <div class="notepad-cover top">
    <div class="notepad-border"></div>
    <div class="notepad-transparency"></div>
    <div class="notepad-box"></div>
    <div class="notepad-holes">
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
      <div class="notepad-hole"></div>
    </div>
    <div class="notepad-rings">
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
      <div class="notepad-ring"></div>
    </div>
  </div>
  <div class="notepad-glossy">
    <div class="inner"></div>
  </div>
</div>
<form class="form-wrapper">
  <div class="option-wrapper">
    <input type="checkbox" name="cool-checkboxes" id="cool1" value="1">
    <label class="label-text" for="cool1">Option 1</label>
  </div>
  <div class="option-wrapper">
    <input type="checkbox" name="cool-checkboxes" id="cool2" value="2">
    <label for="cool2">Option 2</label>
  </div>
  <div class="option-wrapper">
    <input type="checkbox" name="cool-checkboxes" id="cool3" value="3">
    <label for="cool3">Option 3</label>
  </div>
  <div class="button-wrapper">
    <div class="btn-submit">
      Submit
    </div>
  </div>
</form>

LIVE PREVIEW

See the Pen Style Checkboxes with CSS 3 by Peternak Blog (@peternakblog) on CodePen.

Credit: Sean
Powered by Blogger.