Help:Wiki University HTML-- Tables - Column Spans
From FamilySearch Wiki
- Nesting Lists
- Fonts - Changing
- Font Size
- Font Colors
- Font Bold-Italics
- Width and Height
- Tables - Borders
- Tables - Widths
- Tables - Captions
- Tables - Col Labels
- Tables - Cells
- Tables - Rows
- Tables - Placement
- Tables - Sorting
- Tables - Scrolling
- Tables - Col Only
- Tables - Col Spans
- Tables - Row Spans
- Infobox - Creating
- Infobox - Placing
- Infobox - If function
- Position - Relative
- Position - Absolute
SPANNING COLUMNS IN TABLES
- When we create tables, sometimes we want a cell to cover more than one column like in the following example:
|Foods with short shelf life||Foods with long shelf life|
- NOTICE the first row consists of two cells, each spanning two cells of the following row.
This ability to span columns is especially useful when separating sections of one table into different topics.
HOW TO SPAN COLUMNS
- If we want to span two columns, for example, we use a class called "colspan."
- This coding is inserted right after the <td or <th tags:
- NOTICE the "2" represents the number of columns to span.
Here is the coding for the first three rows of the above table:
- NOTICE again the location of the class "colspan."
- NOTICE that the new row only has two cells, but each cell has a "colspan" in it. The two colspans cover the four cells in the next row.
COLUMNS HAVE TO ADD UP
- Make sure that the columns you span add up to the total number of cells in the next row.
- If you span a total of four columns or cells, you must have two colspan="2" in the preceding row, otherwise you will get who knows what!
- You cannot create sortable tables with colspans.
TRY THESE OUT . . . . .
- This is another built in wikitext mini-program.