WEBLEB
होम
संपादक
लॉग इन करें
Pro
हिंदी
English
Français
Español
Português
Deutsch
Italiano
हिंदी
HTML
CSS
JS
Document
body { background-color: #212121; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .switch { font-size: 30px; position: relative; display: inline-block; width: 4em; height: 0.3em; } /* Hide default HTML checkbox */ .switch input { opacity: 1; width: 0; height: 0; } /* The slider */ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #900c3f; transition: 0.4s; } .off { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: 0.4s; image-rendering: pixelated; opacity: 1; left: 0; bottom: -0.8em; } .on { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: 0.4s; image-rendering: pixelated; opacity: 0; left: 0; bottom: -0.8em; } .switch input:checked + .slider { background-color: #c70039; } .switch input:focus + .slider { box-shadow: 0 0 1px #c70039; } .switch input:checked ~ .off { transform: translateX(2em); } .switch input:checked ~ .on { transform: translateX(2em); opacity: 1; box-shadow: 0 0 10px 5px rgba(185, 178, 42, 0.919), 0 0 20px 10px rgba(199, 186, 0, 0.3), 0 0 30px 15px rgba(199, 0, 57, 0.1); }
//This code does not need javascript:)
Validating your code, please wait...
HTML
CSS
JS
Document
body { background-color: #212121; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .switch { font-size: 30px; position: relative; display: inline-block; width: 4em; height: 0.3em; } /* Hide default HTML checkbox */ .switch input { opacity: 1; width: 0; height: 0; } /* The slider */ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #900c3f; transition: 0.4s; } .off { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: 0.4s; image-rendering: pixelated; opacity: 1; left: 0; bottom: -0.8em; } .on { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: 0.4s; image-rendering: pixelated; opacity: 0; left: 0; bottom: -0.8em; } .switch input:checked + .slider { background-color: #c70039; } .switch input:focus + .slider { box-shadow: 0 0 1px #c70039; } .switch input:checked ~ .off { transform: translateX(2em); } .switch input:checked ~ .on { transform: translateX(2em); opacity: 1; box-shadow: 0 0 10px 5px rgba(185, 178, 42, 0.919), 0 0 20px 10px rgba(199, 186, 0, 0.3), 0 0 30px 15px rgba(199, 0, 57, 0.1); }
//This code does not need javascript:)