CSS Switches

Developer
Size
2,995 Kb
Views
8,096

How do I make an css switches?

What is a css switches? How do you make a css switches? This script and codes were developed by Daniesy on 10 January 2023, Tuesday.

CSS Switches Previews

CSS Switches - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Switches</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h2 class="text-center">CSS Switches<br><sup>#nojs</sup></h2>
<div class="text-center"> <input type="checkbox" id="switch1" class='switch' checked/> <label for="switch1"></label> <input type="checkbox" id="switch2" class='switch red' checked/> <label for="switch2"></label> <input type="checkbox" id="switch3" class='switch green' checked/> <label for="switch3"></label> <input type="checkbox" id="switch4" class='switch green' disabled/> <label for="switch4"></label>
</div> <script src="js/index.js"></script>
</body>
</html>

CSS Switches - Script Codes CSS Codes

/* Some color definitions */
/* Some styling */
body { background: #442242; color: white; display: flex; height: 100vh; flex-direction: column; justify-content: center;
}
sup { color: #AF5D6C;
}
.text-center { text-align: center;
}
/* Important switch stuff */
input[type=checkbox].switch + label { width: 34px; height: 14px; background: lightgray; display: inline-block; border-radius: 10px; position: relative; cursor: pointer; margin: 10px;
}
input[type=checkbox].switch + label:before, input[type=checkbox].switch + label:after { content: ""; display: inline-block; width: 20px; height: 20px; background: white; border-radius: 50%; position: absolute; top: -3px; left: 0; transition: all .2s;
}
input[type=checkbox].switch + label:after { box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 2px 1px -1px rgba(0, 0, 0, 0.12);
}
input[type=checkbox].switch + label:before { background: lightgray; transform: scale3d(0, 0, 1);
}
input[type=checkbox].switch + label:active:before { transform: scale3d(3, 3, 1); opacity: 0;
}
input[type=checkbox].switch { display: none;
}
input[type=checkbox].switch:checked + label { background: rgba(3, 155, 229, 0.5);
}
input[type=checkbox].switch:checked + label:before, input[type=checkbox].switch:checked + label:after { left: 14px; background: #039be5;
}
input[type=checkbox].switch:disabled + label { opacity: 0.4; cursor: not-allowed;
}
input[type=checkbox].switch.green { display: none;
}
input[type=checkbox].switch.green:checked + label { background: rgba(4, 196, 52, 0.5);
}
input[type=checkbox].switch.green:checked + label:before, input[type=checkbox].switch.green:checked + label:after { background: #04c434;
}
input[type=checkbox].switch.red { display: none;
}
input[type=checkbox].switch.red:checked + label { background: rgba(244, 67, 54, 0.5);
}
input[type=checkbox].switch.red:checked + label:before, input[type=checkbox].switch.red:checked + label:after { background: #f44336;
}

CSS Switches - Script Codes JS Codes

// Say [email protected]
CSS Switches - Script Codes
CSS Switches - Script Codes
Home Page Home
Developer Daniesy
Username daniesy
Uploaded January 10, 2023
Rating 4.5
Size 2,995 Kb
Views 8,096
Do you need developer help for CSS Switches?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Daniesy (daniesy) Script Codes
Create amazing love letters with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!