Tue Jul 12 2022
Custom Checkbox
CSS1413 views
File Name: custom-checkbox.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Checkbox</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rubik&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
font-family: 'Rubik', sans-serif;
}
body {
background-color: #383838;
}
section {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
}
ul li {
list-style: none;
margin: 20px 0;
}
input[type=checkbox] {
appearance: none;
width: 25px;
height: 25px;
background-color: #fff;
border-radius: 4px;
display: inline-block;
vertical-align: middle;
position: relative;
transition: 0.3s all ease-in-out;
cursor: pointer;
}
input[type=checkbox]:checked {
background-color: #fc5000;
}
input[type=checkbox]::before {
position: absolute;
content: '\2713';
font-size: 50px;
line-height: 15px;
color: #fff;
transform: scale(0);
transition: 0.3s all ease-in-out;
}
input[type=checkbox]:checked::before {
transform: scale(1);
}
label {
font-size: 20px;
color: #fff;
display: inline-block;
vertical-align: middle;
margin-left: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<section>
<ul>
<li>
<input type="checkbox" name="" id="check1" />
<label for="check1">
Frontend Dev
</label>
</li>
<li>
<input type="checkbox" name="" id="check2" />
<label for="check2">
Backend Dev
</label>
</li>
<li>
<input type="checkbox" name="" id="check3" />
<label for="check3">
Full Stack Dev
</label>
</li>
</ul>
</section>
</body>
</html>
Result Screenshot(s)
Author:Geekboots