WEBLEB
Início
Editor
Entrar
Pro
Português
English
Français
Español
Português
Deutsch
Italiano
हिंदी
HTML
CSS
JS
Andev Web
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #212121; } .switch { font-size: 17px; position: relative; display: inline-block; width: 4em; height: 2em; } .switch input { opacity: 1; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; } .off { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: .4s; image-rendering: pixelated; opacity: 1; } .on { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: .4s; image-rendering: pixelated; opacity: 0; } .switch input:checked + .slider { background-color: #ccc; } .switch input:focus + .slider { box-shadow: 0 0 1px #ccc; } .switch input:checked ~ .off { transform: translateX(2em); } .switch input:checked ~ .on { transform: translateX(2em); opacity: 1; }
Validating your code, please wait...
HTML
CSS
JS
Andev Web
body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; background-color: #212121; } .switch { font-size: 17px; position: relative; display: inline-block; width: 4em; height: 2em; } .switch input { opacity: 1; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; } .off { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: .4s; image-rendering: pixelated; opacity: 1; } .on { position: absolute; content: ""; height: 2em; width: 2em; background-color: white; transition: .4s; image-rendering: pixelated; opacity: 0; } .switch input:checked + .slider { background-color: #ccc; } .switch input:focus + .slider { box-shadow: 0 0 1px #ccc; } .switch input:checked ~ .off { transform: translateX(2em); } .switch input:checked ~ .on { transform: translateX(2em); opacity: 1; }