Help:Wiki University Wikitext--Tables
Lessons
- HOME
- Introduction
- Headers
- Lists
- Nesting Lists
- Links
- Broken Links
- Comments
- Categories
- Image Embedding
- Image Tooltips & Borders
- Image Links
- Images & Text; Embedding PDF
- Snipping Tool & Paint
- Paragraphs
- Inline Styling
- Changing Fonts
- Font Colors
- Backgrounds
- Multi-attributes
- Font Bold-Italics
- Div Tag - Intro
- Borders
- Padding
- Margins
- Width and Height
- Alignment - Horizontal
- Tables
- Breadcrumb Trails
- Ref/Footnotes
- SEO
Intermediate
Advanced
Flexbox
Additional Helps
Birth | Marriage | Death | Court | Land | Probate |
1914* | 1845 | 1914* | 1845 | 1845 | 1845 |
- Now that you are familiar with borders, padding, margins, colors, etc., you are ready to advance to learning how to create and edit tables like the one above.
- Once you are familiar with tables, you will have the tools to create and edit Templates, Sidebars and NavBoxes, so pay close attention to how tables are created.
Opening and closing tags[edit | edit source]
Tables have opening and closing tags:
This is the opening table tag: {|
- NOTICE that it consists of a curly bracket and a pipe.
This is the closing table tag: |}
- NOTICE that it consists of a pipe and a curly bracket.
- Just the opposite of the opening table tag.
These two tags open and close a table.
Rows[edit | edit source]
Tables consist of rows with cells. However rows have NO CLOSING tag. Rows are created with a |-
- NOTICE that it consists of a pipe and a dash.
Cells[edit | edit source]
Rows are made up of cells where the actual information is displayed. Cells have NO CLOSING tag. Cells are created with just a |
- NOTICE that it consists only of a pipe.
Tables are many rows of cells[edit | edit source]
This is wikitext coding for a table with one row populated with four cells:
{|
|-
|
|
|
|
|}
If we were to load this, we would see nothing because the individual cells must have something in them in order to display:
{|
|-
| Apples
| Carrots
| Peanuts
| Wheat
|}
- NOTICE the opening and closing table tags
- NOTICE the row tag has no closing tag
- NOTICE each cell has no closing tag
This is how our beginning table looks on the page:
Apples | Carrots | Peanuts | Wheat |
To add another row of cells, just repeat the row tag and cell tags:
{|
|-
|
|
|
|
|-
|
|
|
|
|}
Here is our table with two rows and four cells in each row
{|
|-
| Apples
| Carrots
| Peanuts
| Wheat
|-
| Pears
| Peas
| Walnuts
| Soybeans
|}
- Here is our table so far:
Apples | Carrots | Peanuts | Wheat |
Pears | Peas | Walnuts | Soybeans |
- NOTICE this table does not look much like a table. Tables usually have borders, column titles, etc.
Borders and background colors[edit | edit source]
As we have said, our little table looks like two sentences. Tables usually have borders and sometimes background colors. A simplistic way to add borders to our table is to add the following code to the opening table tag: class="wikitable"
Here is the coding:
{| class="wikitable"
|-
| Apples
| Carrots
| Peanuts
| Wheat
|-
| Pears
| Peas
| Walnuts
| Soybeans
|}
Here's what our table looks like with the class wikitable added to the opening table tag:
Apples | Carrots | Peanuts | Wheat |
Pears | Peas | Walnuts | Soybeans |
- NOTICE that each cell is enclosed with a border.
- NOTICE there is padding around each word in the cells.
- NOTICE there is a background color of a light gray.
Adding rows and cells[edit | edit source]
To add rows and cells, add your row tags followed by your cell tags. You can add as many as you like. To find out about having other kinds of borders and background colors go to Intermediate Wikitext Training
Try these out[edit | edit source]
- Create a table with four rows and four cells in each row which, when you "show preview", displays the following:
- In the first column four fruits are listed.
- In the second column, four vegetables are listed.
- In the third column, four nuts are listed.
- In the fourth column, four grains are listed.
- NOTE: This exercise will teach you how to arrange items into columns using cells. Compare your results to the answer sheet. If it differs, see if you can determine why your answer might be different.
- Tables do not need a closing tag
- A. True
- B. False
- Rows must have a closing tag
- A. True
- b. False
- Cells must have something in them for the table to be visible.
- A. True
- B. False
- ↑ Alice Eichholz, Red Book: American State, County and Town Sources, 3rd ed. (Salt Lake City: Ancestry Pub., 2004), 65-67. At various libraries (WorldCat); FHL Book 973 D27rb 2004.