Saturday, 13 August 2016

Style HTML Checkbox

<!DOCTYPE html>
<html>
<head>
 <title>Style HTML Checkbox</title>
</head>
<body>
<style>

div{margin:30px;}
label {
    display: inline-block;
    cursor: pointer;
    position: relative;
    font-size: 13px;
    margin-right:10px;
}
label:before {
    content:"";
    display: inline-block;
    width:25px;
    height: 25px;
    margin-right: 10px;
    position: absolute;
    left: 0;
    bottom: 1px;
    background-color: #fff;
    box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .3), 0px 1px 2px 0px rgba(255, 255, 255, .8);
    border-radius: 3px;
}
input[type=checkbox] {
    display: none;
}
input[type='checkbox']:checked + label:before {
    content:"\2713";
     position:absolute;
    font-size: 18px;
    color: #000;
    text-align:center;
    
}

</style>
<div>
<input  type="checkbox" class="checkbox" checked="true" />
<label></label>
</div>
</body>
</html>

No comments:

Post a Comment