WEBLEB
Home
Editor
Accedi
Pro
Italiano
English
Français
Español
Português
Deutsch
Italiano
हिंदी
Esempio HTML di interruttore a levetta CSS
44
VV01D_
Apri nell'Editor
Video
Pubblica il Tuo Codice
0
Consigliato
5 February 2026
Esplosione di blocchi!
12 December 2025
Posizione della sorella FNAF
10 January 2026
Codice HTML CSS della barra di navigazione di avvio AI
HTML
Copy
Document
CSS
Copy
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); }
JS
Copy
//This code does not need javascript:)