Suggest an editImprove this articleRefine the answer for “What does the rowspan attribute do?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**The `rowspan` attribute** on `<td>` and `<th>` tags defines how many rows down a cell stretches, merging them vertically. **Key point:** its default value is 1, and it merges vertically, unlike `colspan`, which merges columns horizontally.Shown above the full answer for quick recall.Answer (EN)ImageThe `rowspan` attribute in HTML is used on `<td>` and `<th>` tags to **merge cells vertically**, meaning it lets a single cell **span several table rows at once**. --- ### Main purpose `rowspan` defines **how many rows down** a cell will stretch. While a regular cell occupies one row, with `rowspan` it can merge two, three, or more. --- ### Example: ```html <table border="1"> <tr> <th>Name</th> <th>City</th> </tr> <tr> <td rowspan="2">Maria</td> <td>Warsaw</td> </tr> <tr> <td>Berlin</td> </tr> </table> ``` Here the cell with the name **"Maria"** spans two rows and sits to the left of two different cities. --- ### Explanation: - The `rowspan="2"` attribute tells the browser: *this cell should occupy two consecutive rows*. - Likewise, `rowspan="3"` spans three rows, and so on. --- ### Example in a summary table: ```html <table border="1"> <tr> <th rowspan="2">Category</th> <th colspan="2">Metrics</th> </tr> <tr> <th>2024</th> <th>2025</th> </tr> <tr> <td>Income</td> <td>1.2M</td> <td>1.5M</td> </tr> </table> ``` Here `rowspan="2"` merges the "Category" cell vertically, while `colspan="2"` merges the headers horizontally. --- ### Important: - The `rowspan` value is a **positive integer** (for example, `rowspan="3"`). - The default is `1` (the cell is not merged). - Setting too large a value can break the table's structure. --- ### Difference between `colspan` and `rowspan`: | Attribute | Merges | Direction | |---|---|---| | `colspan` | Columns | Horizontal | | `rowspan` | Rows | Vertical | --- ### Conclusion: The `rowspan` attribute merges **cells vertically**, letting a single cell span several rows. It is used to build more complex tables with data hierarchies, totals, and groupings.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.