Help:Introduction to tables with Wiki Markup/2: Difference between revisions
rm "adding row and column" to separate page |
removing doublespacing (inter-paragraph spacing now controlled by Template:Intro to/styles.css) |
||
(15 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{pp-protected|small=yes}}{{pp-move-indef}}</noinclude>{{intro to| |
|||
{{intro to| |
|||
[[File:Advanced toolbar of vector skin.png|Enhanced editing toolbar|frameless|border|center|480px]] |
|||
Whether you've just inserted a new table, or are editing an existing one, changing the text in the table cells determines what the table looks like to a reader. But you can do more than just change text. |
Whether you've just inserted a new table, or are editing an existing one, changing the text in the table cells determines what the table looks like to a reader. But you can do more than just change text. |
||
A table consists of the following basic elements, which you can modify: |
A table consists of the following basic elements, all of which you can modify: |
||
{{/table 2}} |
{{Help:Introduction to tables with Wiki Markup/2/table 2}} |
||
Blank spaces at the beginning and end of a cell are ignored. |
Blank spaces at the beginning and end of a cell are ignored. |
||
=== Layout === |
=== Layout === |
||
⚫ | |||
{{Help:Introduction to tables with Wiki Markup/2/markup_examples}} |
|||
⚫ | |||
{{/markup_examples}} |
|||
To a reader, both of the above examples will look the same: |
To a reader, both of the above examples will look the same: |
||
{{/table 1}} |
{{Help:Introduction to tables with Wiki Markup/2/table 1}} |
||
}}<noinclude> |
|||
}} |
|||
[[Category:Wikipedia tables]] |
[[Category:Wikipedia tables]] |
||
</noinclude> |
Latest revision as of 05:35, 7 November 2021
Introduction to tables
How and why
Editing tables
The basics
Expanding tables
Adding rows and columns
Summary
Review of what you've learned
Whether you've just inserted a new table, or are editing an existing one, changing the text in the table cells determines what the table looks like to a reader. But you can do more than just change text.
A table consists of the following basic elements, all of which you can modify:
{|
|
start | Besides beginning the table, this is also where the table's class is defined – for example, class="wikitable" . A table's "class" applies standard Wikipedia formatting to that table. The two most commonly used classes are "wikitable" and "wikitable sortable"; the latter allows the reader to sort the table by clicking on the header cell of any column.
|
---|---|---|
|+
|
caption | Required for accessibility purposes on data tables, and placed only between the table start and the first table row. |
!
|
header cell | Optional. Each header cell starts with a new line and a single exclamation mark (! ), or several header cells can be placed consecutively on the same line, separated by double exclamation marks (!! ).
|
|-
|
new row | To begin a new row of cells, use a single vertical bar (| ) and a hyphen (- ).
|
|
|
new cell in row |
To add a new cell in a row, start each new cell with a new line and a single vertical bar (| ), or several cells can be placed consecutively on the same line, separated by double vertical bars (|| ).
|
|}
|
end | To end the table, use a single vertical bar (| ) and a left facing curly brace (} ) alone on a new line.
|
Blank spaces at the beginning and end of a cell are ignored.
Layout
When you edit an existing table, you'll probably see one of two common ways that the table is laid out:
Data is arranged like a tableThis is useful when there aren't too many columns and the cell contents are short (e.g. just numbers). This is the markup layout that the button will create. {| class="wikitable"
|+ Caption
|-
! Header C1 !! Header C2 !! Header C3
|-
| R1C1 || R1C2 || R1C3
|-
| R2C1 || R2C2 || R2C3
|}
|
Cells are arranged verticallyWith lots of columns, or cells with long contents, putting each cell on a new line can improve readability of the markup. {| class="wikitable"
|+ Caption
|-
! Header C1
! Header C2
! Header C3
|-
| R1C1
| R1C2
| R1C3
|-
| R2C1
| R2C2
| R2C3
|}
|
To a reader, both of the above examples will look the same:
Header C1 | Header C2 | Header C3 |
---|---|---|
R1C1 | R1C2 | R1C3 |
R2C1 | R2C2 | R2C3 |