Welcome to my website U-GINE MEDIA. In this website I teach tutorials and share source code on some programming (HTML, CSS & JavaScript) tutorials.
Before we get started, do well to subscribe to my channel to never miss out on any update that I post every single day.
In this tutorial topic "Simple Glowing Checkbox Buttons In HTML and CSS", we will learn how to create it following these simple easy steps.
Share this to your programmer friends. If y'all learnt something today, make sure to let me in the comments.
If interested in watching the video before running the code below, you can click the play button to get started.
Code Begins
- First, create a folder with any name you like. Then, make the necessary files inside it.
- Create a file called index.html to serve as the main file.
- Create a file called style.css for the CSS code.
- Finally, go to Font Awesome and embed their cdnjs library link to your main index file
To start, add the following HTML codes to your index.html file. These codes include essential HTML markup with different semantic tags, such as div, form, input, button, image, etc., to build the website layout.
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="font-awesome.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Glowing Checkbox</title>
</head>
<body>
<ul>
<li>
<label>
<input type="checkbox">
<div class="icon">
<i class="fa fa-phone"></i>
</div>
</label>
</li>
<li>
<label>
<input type="checkbox">
<div class="icon">
<i class="fa fa-plane"></i>
</div>
</label>
</li>
<li>
<label>
<input type="checkbox">
<div class="icon">
<i class="fa fa-moon"></i>
</div>
</label>
</li>
<li>
<label>
<input type="checkbox">
<div class="icon">
<i class="fa fa-wifi"></i>
</div>
</label>
</li>
<li>
<label>
<input type="checkbox">
<div class="icon">
<i class="fa fa-volume-up"></i>
</div>
</label>
</li>
<li>
<label>
<input type="checkbox">
<div class="icon">
<i class="fa fa-map"></i>
</div>
</label>
</li>
</ul>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
background-color: #111111;
display: flex;
justify-content: center;
align-items: center;
}
ul {
width: 340px;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
background-image: linear-gradient(0deg, #000000, #0c0c0c);
border: 3px solid #000000;
border-radius: 10px;
overflow: hidden;
padding: 20px;
margin: 0;
position: relative;
}
ul::before {
content: "";
width: 100%;
height: 100%;
background-color: rgba(255, 255, 255, 0.05);
bottom: -50%;
left: 0;
pointer-events: none;
position: absolute;
z-index: 1;
}
li {
position: relative;
list-style: none;
margin: 15px;
text-align: center;
}
label {
position: relative;
}
input {
position: absolute;
cursor: pointer;
opacity: 0;
}
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 60px;
height: 60px;
background: #101010;
border: 3px solid #000000;
border-radius: 10px;
cursor: pointer;
font-size: 1.3em;
transition: background 0.5s ease, border-color 0.5s ease, box-shasow 0.5s ease;
}
.fa {
color: #222222;
font-size: 2em;
transition: color 0.5s ease, text-shasow 0.5s ease;
}
input:checked ~ .icon {
background: #000000;
border-color: #ffffff;
box-shadow: 0 0 10px rgba(33, 156, 243, 0.5),;
box-shadow: 0 0 20px rgba(33, 156, 243, 0.5),;
box-shadow: 0 0 30px rgba(33, 156, 243, 0.5),;
box-shadow: 0 0 10px #219cf3 inset;
}
input:checked ~ .icon .fa {
color: #ffffff;
text-shadow: 0 0 21px #219cf3;
}
0 Comments
We are happy to hear from you.