<form>
<p class="check">
<input type="checkbox" name="abc" value="1" id="check1"><label class="checkbox-paint" for="check1">チェックボックス四角</label>
</p>
<p class="check">
<input type="checkbox" name="def" value="2" id="check2"><label class="checkbox-mark" for="check2">チェックボックスチェックマーク</label>
</p>
</form>
/* reset */
input,label,select,button,textarea{
appearance: none;
appearance: none;
appearance: none;
margin:0;
border:0;
padding:0;
display:inline-block;
vertical-align:middle;
white-space:normal;
background:none;
}
input:focus,
select:focus,
textarea:focus{outline:0;}
.check input {
display: none;
}
.check label {
position: relative;
padding: 4px 0 0 40px;
cursor: pointer;
}
.check label::before,
.check label::after {
position: absolute;
content: '';
}
.check label::before {
top: 0;
left: 0;
width: 30px;
height: 30px;
border: 1px solid #d0cfcf;
}
.check .checkbox-paint::after {
top: 7px;
left: 7px;
width: 18px;
height: 18px;
background-color: #004099;
opacity: 0;
}
.check .checkbox-mark::after {
top: 50%;
left: 10px;
display: block;
margin-top: -10px;
width: 9px;
height: 16px;
border-right: 3px solid #004099;
border-bottom: 3px solid #004099;
transform: rotate(45deg);
transform: rotate(45deg);
transform: rotate(45deg);
opacity: 0;
}
.check input:checked + label::after {
opacity: 1;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.