AA and C merged horizontally in the first row, B in the second row.
BA in the first column spanning two rows, B and C stacked vertically in the second column.
CA and B in the first row, C in a new row but under A.
DA, B, and C all in one row horizontally.
Attempts:
2 left
💡 Hint
Remember, rowspan merges cells vertically.
✗ Incorrect
The cell with rowspan="2" merges vertically across two rows, so 'A' covers the first column in both rows. 'B' and 'C' appear in the second column stacked vertically.
❓ rendering
intermediate
2:00remaining
What does colspan="3" do in this table?
Check this table code. What will the first row look like in the browser?
AThe second row has fewer cells than the first, causing layout issues.
BThe browser shows an extra empty cell in the second row.
CThe table renders normally with no visible error.
DThe browser throws a syntax error and does not render the table.
Attempts:
2 left
💡 Hint
Count columns in each row after merging.
✗ Incorrect
The first row has 3 columns total (colspan=2 plus one cell). The second row has only 2 cells, so the table layout is uneven and may cause rendering issues.
❓ accessibility
advanced
2:00remaining
Which attribute improves accessibility for merged table cells?
When merging cells in a table, which attribute helps screen readers understand the table structure better?
Aaria-colspan
Baria-rowspan
Ctabindex
Dscope
Attempts:
2 left
💡 Hint
This attribute defines the cell's role as header for rows or columns.
✗ Incorrect
The 'scope' attribute on
elements tells screen readers if the header applies to a row, column, or group, improving accessibility especially with merged cells.
❓ selector
expert
2:00remaining
Which CSS selector targets all cells merged horizontally with colspan?
You want to style all table cells that have a colspan attribute. Which CSS selector works?
Atd[colspan]
Btd.colspan
Ctd#colspan
Dtd::colspan
Attempts:
2 left
💡 Hint
Attribute selectors use square brackets.
✗ Incorrect
The selector td[colspan] selects all
elements with a colspan attribute, regardless of its value.
Practice
(1/5)
1. What does the colspan attribute do in an HTML table?
easy
A. It merges cells horizontally across columns.
B. It merges cells vertically across rows.
C. It changes the color of a cell.
D. It adds a border around a cell.
Solution
Step 1: Understand the purpose of colspan
The colspan attribute is used in a table cell to make it span across multiple columns horizontally.
Step 2: Compare with rowspan
rowspan merges cells vertically across rows, so it is different from colspan.
Final Answer:
It merges cells horizontally across columns. -> Option A
A. Second row has only two cells but first row has three columns, causing layout mismatch.
B. The colspan attribute value should be '3' instead of '2'.
C. The colspan attribute is not allowed on td elements.
D. The table is missing a thead section.
Solution
Step 1: Count columns in first row
The first row has a cell with colspan='2' plus one more cell, so total columns = 2 + 1 = 3.
Step 2: Count columns in second row
The second row has only two cells, so only 2 columns, which causes a mismatch in table layout.
Final Answer:
Second row has only two cells but first row has three columns, causing layout mismatch. -> Option A
Quick Check:
Column count must match in all rows [OK]
Hint: Ensure all rows have same total columns after colspan [OK]
Common Mistakes:
Ignoring column count mismatch
Thinking colspan value must match total columns
Believing colspan is invalid on <td>
5. You want to create a table where the top-left cell spans 2 rows and 3 columns. Which is the correct way to write this cell?
hard
A. <td rowspan='3' colspan='2'>Top Left</td>
B. <td rowspan='2' colspan='3'>Top Left</td>
C. <td colspan='2' rowspan='3'>Top Left</td>
D. <td colspan='3'>Top Left</td>
Solution
Step 1: Identify correct rowspan and colspan values
The cell should span 2 rows vertically and 3 columns horizontally, so rowspan='2' and colspan='3' are needed.
Step 2: Check attribute order and correctness
Attributes can be in any order, but <td rowspan='2' colspan='3'>Top Left</td> correctly uses rowspan='2' and colspan='3'. Other options have swapped or incorrect values.
Final Answer:
<td rowspan='2' colspan='3'>Top Left</td> -> Option B
Quick Check:
Rowspan = rows, colspan = columns [OK]
Hint: Use rowspan for rows, colspan for columns together [OK]
Common Mistakes:
Swapping rowspan and colspan values
Using wrong numbers for spans
Omitting one of the attributes
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.