CSS tips --input checkbox css style landscaping

Change the default style for:

HTML

<input class="magic-checkbox" type="checkbox" name="layout" id="yyc1">
<label for="yyc1"></label>
复制代码

CSS


.magic-checkbox {
  position: absolute;
  display: none; }

.magic-checkbox[disabled] {
  cursor: not-allowed; }

.magic-checkbox + label {
  position: relative;
  display: block;
  padding-left: 30px;
  cursor: pointer;
  vertical-align: middle; 
}
  .magic-checkbox + label:hover:before {
    animation-duration: 0.4s;
    animation-fill-mode: both;
    animation-name: hover-color; 
  }

  .magic-checkbox + label:before {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-block;
    width: 20px;
    height: 20px;
    content: '';
    border: 1px solid #c0c0c0; 
  }
 
  .magic-checkbox + label:after {
    position: absolute;
    display: none;
    content: ''; }

.magic-checkbox[disabled] + label {
  cursor: not-allowed;
  color: #e4e4e4; 
}
  .magic-checkbox[disabled] + label:hover,
  .magic-checkbox[disabled] + label:before,
  .magic-checkbox[disabled] + label:after {
    cursor: not-allowed; 
  }


  .magic-checkbox[disabled] + label:hover:before {
    border: 1px solid #e4e4e4;
    animation-name: none; 
  }

  .magic-checkbox[disabled] + label:before {
    border-color: #e4e4e4; 
  }

.magic-checkbox:checked + label:before {
  animation-name: none; 
}

.magic-checkbox:checked + label:after {
  display: block; 
}

.magic-checkbox + label:before {
  border-radius: 10px; }

.magic-checkbox + label:after {
  top: 2px;
  left: 7px;
  box-sizing: border-box;
  width: 6px;
  height: 12px;
  transform: rotate(45deg);
  border-width: 2px;
  border-style: solid;
  border-color: #fff;
  border-top: 0;
  border-left: 0; }

.magic-checkbox:checked + label:before {
  border: #3e97eb;
  background: #3e97eb; }

复制代码

Reproduced in: https: //juejin.im/post/5d0a4e5251882514c324b387

Guess you like

Origin blog.csdn.net/weixin_33798152/article/details/93165932
Recommended