The table
Section 1: HTML: the page's contentLesson 1.5 · ⏱ 7 min
<table> is a table, every row is <tr>, a heading cell is <th>, and a normal cell is <td>.
HTML
<h1>My marks</h1>
<table>
<tr><th>Subject</th><th>Mark</th></tr>
<tr><td>Math</td><td>95</td></tr>
<tr><td>Science</td><td>90</td></tr>
<tr><td>Arabic</td><td>88</td></tr>
</table>
CSS
body { font-family: Tahoma; }
td, th { border: 1px solid #999; padding: 6px 12px; }
🖥️ The page in Robo Web:

📌 Another example: the school timetable
The headings row uses th, and every day is a tr row.
HTML
<table>
<tr><th>Day</th><th>First lesson</th><th>Second lesson</th></tr>
<tr><td>Sunday</td><td>Maths</td><td>Science</td></tr>
<tr><td>Monday</td><td>Arabic</td><td>Coding</td></tr>
</table>
CSS
body { font-family: Tahoma, sans-serif; }
table { border-collapse: collapse; }
th, td { border: 1px solid #999; padding: 6px 12px; }
th { background: #E8F0FF; }
🖥️ The page in Robo Web:

✍️ Practise
The table.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
A table with two rows and two columns: the name and the age.
👀 Show the solution🙈 Hide the solution
HTML
<table border="1">
<tr><td>Ali</td><td>10</td></tr>
<tr><td>Mona</td><td>9</td></tr>
</table>
CSS
body { font-family: Tahoma, sans-serif; }
🖥️ The page in Robo Web:

Result: a 2 × 2 table.
Medium
Add a coloured th headings row.
👀 Show the solution🙈 Hide the solution
HTML
<table border="1">
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Ali</td><td>10</td></tr>
<tr><td>Mona</td><td>9</td></tr>
</table>
CSS
body { font-family: Tahoma, sans-serif; }
th { background: gold; }
🖥️ The page in Robo Web:

Result: the headings row is gold.
Hard
The 2 times table: three rows (2×1, 2×2, 2×3) with the answer in a column.
👀 Show the solution🙈 Hide the solution
HTML
<table border="1">
<tr><th>The sum</th><th>The answer</th></tr>
<tr><td>2 × 1</td><td>2</td></tr>
<tr><td>2 × 2</td><td>4</td></tr>
<tr><td>2 × 3</td><td>6</td></tr>
</table>
CSS
body { font-family: Tahoma, sans-serif; }
td, th { padding: 4px 14px; }
🖥️ The page in Robo Web:

Result: four rows.

