Help:Wiki University Wikitext--Tables - Column Spans
Jump to navigation Jump to search
- Nesting Lists
- Broken Links
- Image Embedding
- Image Tooltips & Borders
- Image Links
- Images & Text; Embedding PDF
- Snipping Tool & Paint
- Inline Styling
- Changing Fonts
- Font Colors
- Font Bold-Italics
- Div Tag - Intro
- Width and Height
- Alignment - Horizontal
- Breadcrumb Trails
Other Coding Options
Spanning columns in tables[edit | edit source]
- 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[edit | edit source]
- If we want to span two columns, for example, we use a class called "colspan."
- This coding is inserted right after either the | or ! tags.
- When using the pipe "|", you will need to add in the "text-align:center" attribute in order for the name to be centered:
- If you use the "!" instead of the pipe "|", then the name defaults to the center and is bolded:
- Here is the coding for the first three rows of the above table using a pipe:
- NOTICE again the location of the class "colspan."
- NOTICE a pipe needs to be added before the title, separating it from the colspan and style commands.
- 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[edit | edit source]
- 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!
Restrictions[edit | edit source]
- You cannot create sortable tables with colspans.
Try these out[edit | edit source]
- This is another built in wikitext mini-program.