728x90
반응형

체크박스 자체가 CSS 적용하는 것은 불가능 하므로

input 체크박스를 숨기고 label로 가짜 체크박스를 만들어준다

 

.remember-check {
  /* 실제 체크박스는 화면에서 숨기고 */
  display: none;
}
.remember-check + label {
  display: inline-block;
  position: relative;
  cursor: pointer;
}
.remember-check + label:before {
  /*가짜체크박스*/
  content: " ";
  display: inline-block;
  width: 13px; /* 체크박스의 너비를 지정 */
  height: 13px; /* 체크박스의 높이를 지정 */
  line-height: 13px; /*세로정렬을 위해 높이값과 일치 */
  margin: -2px 2px 0 0;
  text-align: center;
  vertical-align: middle;
  background: #fafafa;
  border: 1px solid #cacece;
  border-radius: 3px;
}
.remember-check:checked + label:before {
  /* 체크박스를 체크했을때 */
  font-family: "FontAwesome";
  content: "\f00c";
  color: red;
  font-size: 10px;
}
728x90
반응형