Professional 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>Professional Table Press</title> <style> body { font-family: 'Arial', sans-serif; background-color: #f4f4f9; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .table-container { width: 80%; margin: 20px auto; overflow: hidden; background: #fff; box-shadow: 0 0 20px rgba(0,0,0,0.1); border-radius: 10px; animation: fadeIn 1s ease-in-out; } table { width: 100%; border-collapse: collapse; } thead { background-color: #6200ea; color: #fff; font-size: 1.1em; text-align: left; } th, td { padding: 15px; text-align: left; border-bottom: 1px solid #ddd; } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #f1f1f1; transition: background-color 0.3s ease; } th.sortable:hover { cursor: pointer; color: #ffeb3b; } .icon { margin-right: 8px; } @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .tooltip { position: relative; display: inline-block; } .tooltip .tooltiptext { visibility: hidden; width: 120px; background-color: #555; 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="professionalTable"> <thead> <tr> <th class="sortable">Name <span class="icon">🔍</span></th> <th class="sortable">Age <span class="icon">🎂</span></th> <th class="sortable">Occupation <span class="icon">💼</span></th> <th class="sortable">Location <span class="icon">📍</span></th> </tr> </thead> <tbody> <tr> <td class="tooltip">John Doe<span class="tooltiptext">User 1</span></td> <td>28</td> <td>Developer</td> <td>New York</td> </tr> <tr> <td class="tooltip">Jane Smith<span class="tooltiptext">User 2</span></td> <td>34</td> <td>Designer</td> <td>London</td> </tr> <tr> <td class="tooltip">Samuel Green<span class="tooltiptext">User 3</span></td> <td>23</td> <td>Photographer</td> <td>Tokyo</td> </tr> <tr> <td class="tooltip">Alice Johnson<span class="tooltiptext">User 4</span></td> <td>29</td> <td>Writer</td> <td>Sydney</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>