Elegant Heatmap - 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>Elegant Heatmap</title> <style> body { font-family: 'Georgia', serif; background-color: #eae7dc; margin: 0; padding: 20px; display: flex; justify-content: center; align-items: center; height: 100vh; } .elegant-table { border-collapse: separate; border-spacing: 0; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 8px rgba(0,0,0,0.1); background-color: #fff; } .elegant-table th, .elegant-table td { padding: 15px; text-align: center; border: 1px solid #ddd; transition: background-color 0.3s ease; } .elegant-table th { background-color: #8e8d8a; color: white; font-size: 1.2em; } .elegant-table td[data-value="low"] { background-color: #f8f8f8; } .elegant-table td[data-value="medium"] { background-color: #e0e0e0; } .elegant-table td[data-value="high"] { background-color: #c0c0c0; } .elegant-table td[data-value="very-high"] { background-color: #a0a0a0; } .elegant-table td[data-value="low"]:hover, .elegant-table td[data-value="medium"]:hover, .elegant-table td[data-value="high"]:hover, .elegant-table td[data-value="very-high"]:hover { background-color: #ffeb3b; color: #000; } </style> </head> <body> <table class="elegant-table"> <thead> <tr> <th>Category</th> <th>Item 1</th> <th>Item 2</th> <th>Item 3</th> <th>Item 4</th> </tr> </thead> <tbody> <tr> <td>Category 1</td> <td data-value="low">😟</td> <td data-value="medium">😐</td> <td data-value="high">😊</td> <td data-value="very-high">😁</td> </tr> <tr> <td>Category 2</td> <td data-value="high">😊</td> <td data-value="very-high">😁</td> <td data-value="low">😟</td> <td data-value="medium">😐</td> </tr> <tr> <td>Category 3</td> <td data-value="medium">😐</td> <td data-value="low">😟</td> <td data-value="very-high">😁</td> <td data-value="high">😊</td> </tr> </tbody> </table> <script> document.querySelectorAll('.elegant-table td').forEach(cell => { cell.addEventListener('click', () => { const value = cell.getAttribute('data-value'); alert(`You clicked on a cell with value: ${value}`); }); }); </script> </body> </html>