Futuristic Tabs - 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>Futuristic Tabs</title> <style> body { font-family: 'Arial', sans-serif; background: #1a1a1a; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; color: #fff; } .tabs { width: 80%; max-width: 800px; background: #2a2a2a; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.5); } .tabs-nav { display: flex; background: #00ff7f; padding: 0; margin: 0; list-style: none; } .tabs-nav li { flex: 1; text-align: center; } .tabs-nav a { display: block; padding: 15px; color: #1a1a1a; font-size: 16px; font-weight: bold; text-decoration: none; position: relative; transition: color 0.3s, background 0.3s; } .tabs-nav a:hover { background: #00b368; } .tabs-nav a:before { content: attr(data-icon); display: block; font-size: 24px; margin-bottom: 5px; } .tabs-nav a.active { background: #1a1a1a; color: #00ff7f; } .tab-content { padding: 20px; display: none; } .tab-content.active { display: block; animation: fadeIn 0.5s ease-in-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } </style> </head> <body> <div class="tabs"> <ul class="tabs-nav"> <li><a href="#" class="tab-link active" data-tab="tab1" data-icon="🌌">Galaxy</a></li> <li><a href="#" class="tab-link" data-tab="tab2" data-icon="🤖">Robotics</a></li> <li><a href="#" class="tab-link" data-tab="tab3" data-icon="🚀">Space</a></li> </ul> <div class="tab-content active" id="tab1"> <h2>Galaxy</h2> <p>Explore the wonders of the galaxy. 🌟</p> </div> <div class="tab-content" id="tab2"> <h2>Robotics</h2> <p>Delve into the world of robotics. 🤖</p> </div> <div class="tab-content" id="tab3"> <h2>Space</h2> <p>Discover the secrets of space. 🚀</p> </div> </div> <script> document.addEventListener("DOMContentLoaded", function() { const tabs = document.querySelectorAll('.tab-link'); const contents = document.querySelectorAll('.tab-content'); tabs.forEach(tab => { tab.addEventListener('click', function(event) { event.preventDefault(); // Remove active class from all tabs and contents tabs.forEach(t => t.classList.remove('active')); contents.forEach(c => c.classList.remove('active')); // Add active class to clicked tab and corresponding content tab.classList.add('active'); document.getElementById(tab.dataset.tab).classList.add('active'); }); }); }); </script> </body> </html>