Help:Wiki University Wikitext--Tables - Row Spans





<< Previous Chapter Next Chapter >>

Spanning rows in tables
Here is an example: This ability to span rows is not quite as useful as spanning columns but it does have its uses.
 * You have learned how to span columns with individual cells; you can also span rows as well.
 * NOTICE in the first column, the first cell of the second row was merged with the first cell of the third row.

How to span rows
rowspan="2"  Here is the coding for the first three rows of the above table: 
 * If a cell is to span two rows, as in the above example, we use a class called "rowspan":
 * This coding is inserted right after the pipe or exclamation marks:
 * rowspan="2" style="width:25%; border:1px solid red" | Apples
 * NOTICE the "2" represents the number of rows to span.
 * However to merge cells in a column, we erase the number of cells in the column to equal to the number we specified in the rowspan attribute minus one.
 * So if we want to merge two cells in a column we erase only the cell immediately below it.
 * If you were combining three cells, you would delete just the two immediately below, not three cells below.
 * NOTICE again the location of the class "rowspan."
 * NOTICE that the third row is missing the FIRST cell because it was merged with the cell in the row above.

Restrictions

 * You cannot create sortable tables with rowspans.

Try these out


 Exercises Use this coding for a table Check your answers
 * Merge the cells with Barley and Buckwheat in them.
 * Merge the cells with Peas, Carrots and Corn in them.

 Quick Quiz
 * If you are going to merge three cells in a column, you must delete the number of cells in the column under the cell to be merged to equal the number call for in the rowspan code minus one.
 * A. True
 * B. False


 * If you want to merge two cells that are under each other in a column, you delete the cell next to it in the row.
 * A. True
 * B. False

Check your answers

<< Previous Chapter Next Chapter >>