Vibrant Table Press - 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 Table Press</title> <style> body { font-family: 'Verdana', sans-serif; background-color: #eceff1; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .table-container { width: 85%; margin: 20px auto; overflow: hidden; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,0.1); border-radius: 12px; animation: zoomIn 1s ease-in-out; } table { width: 100%; border-collapse: collapse; } thead { background-color: #d32f2f; color: #fff; font-size: 1.1em; text-align: left; } th, td { padding: 15px; border-bottom: 1px solid #ddd; } tbody tr:nth-child(even) { background-color: #ffebee; } tbody tr:hover { background-color: #ffcdd2; transition: background-color 0.3s ease; } th.sortable:hover { cursor: pointer; color: #ffeb3b; } .icon { margin-left: 5px; } @keyframes zoomIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } } .tooltip { position: relative; display: inline-block; } .tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: #333; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -60px; opacity: 0; transition: opacity 0.3s; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; } </style> </head> <body> <div class="table-container"> <table id="vibrantTable"> <thead> <tr> <th class="sortable">City <span class="icon">🏙️</span></th> <th class="sortable">Population <span class="icon">👥</span></th> <th class="sortable">Country <span class="icon">🌎</span></th> <th class="sortable">Continent <span class="icon">🌍</span></th> </tr> </thead> <tbody> <tr> <td class="tooltip">New York<span class="tooltiptext">8.4M</span></td> <td>8,400,000</td> <td>USA</td> <td>North America</td> </tr> <tr> <td class="tooltip">Tokyo<span class="tooltiptext">37.4M</span></td> <td>37,400,000</td> <td>Japan</td> <td>Asia</td> </tr> <tr> <td class="tooltip">Paris<span class="tooltiptext">2.1M</span></td> <td>2,100,000</td> <td>France</td> <td>Europe</td> </tr> <tr> <td class="tooltip">Sydney<span class="tooltiptext">5.3M</span></td> <td>5,300,000</td> <td>Australia</td> <td>Australia</td> </tr> </tbody> </table> </div> <script> document.querySelectorAll('th.sortable').forEach(header => { header.addEventListener('click', () => { const table = header.parentElement.parentElement.parentElement; const tbody = table.querySelector('tbody'); Array.from(tbody.querySelectorAll('tr')) .sort((a, b) => { const aText = a.querySelector(`td:nth-child(${header.cellIndex + 1})`).textContent.trim(); const bText = b.querySelector(`td:nth-child(${header.cellIndex + 1})`).textContent.trim(); return aText.localeCompare(bText); }) .forEach(tr => tbody.appendChild(tr)); }); }); </script> </body> </html>