Skip to content

Instantly share code, notes, and snippets.

@yungblud
Created October 23, 2019 07:42
Show Gist options
  • Select an option

  • Save yungblud/4a53be09442f267ea5a03f65df2c93c7 to your computer and use it in GitHub Desktop.

Select an option

Save yungblud/4a53be09442f267ea5a03f65df2c93c7 to your computer and use it in GitHub Desktop.
CheckBox CSS
.checkbox {
  position: absolute;
  display: none;
}

.label:before {
  box-sizing: border-box;
  content: '';
  float: left;
  display: block;
  margin-right: 8px;
  width: 19px;
  height: 19px;
  border: 2px solid #d9d9d9;
  background: #fff;
  flex-shrink: 0;
}

.label {
  display: flex;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

.withoutLabelText:before {
  margin-right: 0;
}

.checkbox:checked + .label:before {
  content: '\E9CA';
  font-family: icomoon;
  line-height: 10px;
  color: #000;
  border: 2px solid #d9d9d9;
  font-size: 20px;
}

.checkBgBlack:checked + .label:before {
  content: '';
  border: 0;
  background: #cbcbcb url(~.svg) 50%/19px 19px;
}

.small1 {
  + label:before {
    width: 16px;
    height: 16px;
  }
  &:checked + .label:before {
    content: '';
    border: 0;
    background: #cbcbcb url(~.svg) 50%/16px 16px;
  }
}

.medium {
  + label:before {
    width: 19px;
    height: 19px;
  }
  &:checked + .label:before {
    content: '';
    border: 0;
    background: #cbcbcb url(~.svg) 50%/19px 19px;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment