Detailed answer
Colspan makes a cell span columns; rowspan makes it span rows.
Count the grid carefully and preserve understandable header relationships. Merging can express some data structures but may increase navigation complexity. Use it for meaningful data relationships rather than to reproduce a decorative page layout.
Example
<table><tr><th colspan="2">HTML reference</th></tr><tr><td>Forms</td><td>Inputs</td></tr></table>
Understanding the behavior
Spanning cells occupy several positions in the table grid. Subsequent cells need to account for that occupied space; otherwise the apparent columns can become misaligned. A span should reflect a real data relationship rather than a visual shortcut.
Practical implementation notes
Sketch the grid before writing complicated spans. If the table becomes difficult to explain or navigate, consider splitting it into simpler tables with clear captions and fewer merged cells.
How to check it
Count the resulting grid positions rather than only the number of tags in each row.
Expected result
The merged header covers exactly the intended columns.
Watch out: Check the effective total number of columns in every row.
Read the reference ↗