Vibrant Collapse - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Vibrant Collapse</title> <style> body { font-family: 'Verdana', sans-serif; background-color: #fffcf7; margin: 0; padding: 20px; display: flex; justify-content: center; align-items: center; height: 100vh; } .vibrant-collapse-container { width: 100%; max-width: 600px; margin: 0 auto; } .vibrant-collapse-header { background-color: #e74c3c; color: #fff; padding: 15px 20px; cursor: pointer; transition: background-color 0.3s ease; } .vibrant-collapse-header:hover { background-color: #c0392b; } .vibrant-collapse-content { max-height: 0; overflow: hidden; transition: max-height 0.5s ease; background-color: #fffcf7; border: 1px solid #e74c3c; border-radius: 0 0 10px 10px; padding: 0 20px; } .vibrant-collapse-content p { padding: 20px 0; margin: 0; color: #333; } .vibrant-collapse-content.show { max-height: 500px; } </style> </head> <body> <div class="vibrant-collapse-container"> <div class="vibrant-collapse-header" onclick="toggleVibrantCollapse(this)"> Click to Expand </div> <div class="vibrant-collapse-content"> <p>This vibrant collapse component adds a splash of color to your page. Perfect for making your content stand out.</p> </div> </div> <script> function toggleVibrantCollapse(element) { const header = element; const content = header.nextElementSibling; content.classList.toggle('show'); } </script> </body> </html>