Toggle navigation
☰
HTML
CSS
Scripting
Database
<!DOCTYPE html> <html> <head> <title>Table Rowspan and Colspan Example</title> <style> body { font-family: sans-serif; margin: 20px; } table { width: 100%; border-collapse: collapse; text-align: center; } table, th, td { border: 1px solid #ccc; } th, td { padding: 10px; } th { background-color: #e9ecef; } .highlight { background-color: #fdf5e6; font-weight: bold; } </style> </head> <body> <table> <tr> <th colspan="3">Weekend Schedule</th> <!-- Spans 3 columns --> </tr> <tr> <th scope="col">Time</th> <th scope="col">Saturday</th> <th scope="col">Sunday</th> </tr> <tr> <td>09:00 - 12:00</td> <td>Work</td> <td rowspan="2" class="highlight">Relax</td> <!-- Spans 2 rows down --> </tr> <tr> <td>12:00 - 18:00</td> <td>Chore</td> <!-- No td needed here for Sunday because the cell above spans into this space --> </tr> </table> </body> </html>