Checkbox as an attractive tick box
CSS
/*-------------------------*/
/*----- TICK CHECKBOX -----*/
/*------------------- -----*/
/* Customize the label (the container) */
.odac_tick_checkbox .container {
display: flex;
align-items: center;
position: relative;
width: 100%;
margin-bottom: 14px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
line-height: 16px;
text-align: left;
padding: 7px 6px 7px 37px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #EBEBEB;
border-radius: 4px;
box-sizing: border-box;
min-height: 40px;
}
.odac_tick_checkbox .container .vert_align_middle {
position: static;
transform: none;
}
/* Hide the browser's default checkbox */
.odac_tick_checkbox .container input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}
/* Create a custom checkbox */
.odac_tick_checkbox .checkmark {
position: absolute;
top: 7px;
left: 6px;
height: 25px;
width: 25px;
background-color: #D3D3D3;
}
/* On mouse-over, add a grey background color */
.odac_tick_checkbox .container:hover input ~ .checkmark {
background-color: #ccc;
}
/* When the checkbox is checked, add a teal background */
.odac_tick_checkbox .container input:checked ~ .checkmark {
background-color: var(--odac-color-main1);
}
/* Create the checkmark/indicator (hidden when not checked) */
.odac_tick_checkbox .checkmark:after {
content: "";
position: absolute;
display: none;
}
/* Show the checkmark when checked */
.odac_tick_checkbox .container input:checked ~ .checkmark:after {
display: block;
}
/* Create the checkmark/indicator symbol (this shape is the tick!)*/
.odac_tick_checkbox .container .checkmark:after {
left: 9px;
top: 5px;
width: 7px;
height: 14px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
HTML
<div class="odac_tick_checkbox">
<label class="container"><div class="vert_align_middle">My Option</div>
<input type="checkbox" name="MyOption" value="1" >
<span class="checkmark"></span>
</label>
</div>
