0
0
HTMLmarkup~20 mins

Table rows and columns in HTML - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Table Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
rendering
intermediate
1:30remaining
What is the visual output of this HTML table?
Look at the HTML code below. How many rows and columns will the table display in the browser?
HTML
<table>
  <tr>
    <td>Apple</td>
    <td>Banana</td>
  </tr>
  <tr>
    <td>Cherry</td>
    <td>Date</td>
  </tr>
</table>
A2 rows and 2 columns
B2 rows and 1 column
C1 row and 2 columns
D1 row and 1 column
Attempts:
2 left
💡 Hint
Count the number of tags for rows and tags inside each for columns.
🧠 Conceptual
intermediate
1:00remaining
Which tag defines a table header cell?
In HTML tables, which tag is used to create a header cell that is usually bold and centered by default?
A<th>
B<td>
C<tr>
D<thead>
Attempts:
2 left
💡 Hint
Header cells are different from regular cells and usually appear at the top of columns.
selector
advanced
1:30remaining
Which CSS selector targets all cells in the second column of a table?
Given a table, which CSS selector will select every cell in the second column only?
Atable tr:nth-child(2) td
Btable tr td:nth-child(2)
Ctable td:nth-of-type(2)
Dtable td:nth-child(2)
Attempts:
2 left
💡 Hint
Think about selecting the second cell inside each row.
layout
advanced
1:30remaining
How to make table columns evenly spaced using CSS?
You want all columns in your HTML table to have equal width regardless of content. Which CSS property and value will achieve this?
Atable { border-collapse: collapse; }
Btable { width: auto; }
Ctable { display: flex; }
Dtable { table-layout: fixed; width: 100%; }
Attempts:
2 left
💡 Hint
One property controls how the browser calculates column widths.
accessibility
expert
2:00remaining
Which attribute improves accessibility by associating table headers with data cells?
To help screen readers understand which header belongs to which data cell in a complex table, which attribute should you use on <td> elements?
Arole
Baria-labelledby
Cheaders
Dscope
Attempts:
2 left
💡 Hint
This attribute lists the IDs of header cells related to the data cell.