Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added on off button #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions OnOffButton/OnOffButton.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<!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">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<style>
body{
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #0c0c0c;
}

label{
position: relative;
width: 80px;
height: 80px;
cursor: pointer;
border-radius: 50%;
}

label .btn{ /*Checkbox is controlled by this*/
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
background: #1b1b1b;
border-radius: 50%;
box-shadow: 0 3px 4px rgba(0, 0, 0, 1),
inset 0 -2px 5px rgba(0, 0, 0, 1),
inset 0 2px 2px rgba(255,255,255,0.5),
0 0 0 2px #000,
0 0 0 5px #0c0c0c,
0 0 0 5.5px #080808;
}

/* label input[type="checkbox"]:checked ~ .btn{
box-shadow: 0 0 0 rgba(0, 0, 0, 1),
inset 0 -2px 5px rgba(0, 0, 0, 1),
inset 0 1px 1px rgba(255,255,255,0.1),
0 0 0 2px #000,
0 0 0 5px #0c0c0c,
0 0 0 5.5px #00a1ff;
} */

label input[type="checkbox"]{
-webkit-appearance: none;
}

label .fa{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
font-size: 2.5em;
color: #0c0c0c;
}

label input[type="checkbox"]:checked ~ .fa{
color: #00ffe7;
text-shadow: 0 0 15px #00a1ff,
0 0 30px #00a1ff;
}
</style>
<title>On Off Button</title>
</head>
<body>
<label>
<input type="checkbox" name="">
<span class="btn"></span>
<i class="fa fa-power-off"></i>
</label>

</body>
</html>