Titre : Animation menu -> croix
Description : checkbox, animation trois barres qui se transforment en croix
Code : <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hamburger</title> <style> body { margin: 0; height: 100vh; } #bouton-menu { display: none; } .hamburger { width: 100px; height: 100px; background-color: #b36565; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 15px; cursor: pointer; border-radius: 10px; } .hamburger div { width: 60px; height: 5px; background: #222; border-radius: 5px; transform-origin: center; } #bouton-menu:checked + .hamburger div:nth-child(1) { transform: translateY(20px) rotate(45deg); } #bouton-menu:checked + .hamburger div:nth-child(2) { opacity: 0; } #bouton-menu:checked + .hamburger div:nth-child(3) { transform: translateY(-20px) rotate(-45deg); } </style> </head> <body> <input type="checkbox" id="bouton-menu"> <label for="bouton-menu" class="hamburger"> <div></div> <div></div> <div></div> </label> </body> </html>
Langage de Prism :
Mettre à jour