Help:Tables

From Appropedia
Jump to: navigation, search

To insert a table you can click the insert table button Button insert table.png on the edit toolbar that appears when you click edit on a page.

This is what the edit toolbar look like.

Which will insert the following:

{| class="wikitable"
|-
! header 1
! header 2
! header 3
|-
| row 1, cell 1
| row 1, cell 2
| row 1, cell 3
|-
| row 2, cell 1
| row 2, cell 2
| row 2, cell 3
|}
that creates
header 1 header 2 header 3
row 1, cell 1 row 1, cell 2 row 1, cell 3
row 2, cell 1 row 2, cell 2 row 2, cell 3

Format options[edit]

For basic formatting, with lines and light shading, use: class="wikitable"

Style commands:

  • To align the table and allow text to wrap, use "float:right" or "float:left"
  • Headers: start these rows with exclamation marks (!)
  • To make space between the table and surrounding text or objects, use margin, e.g margin:.5em; (inside the style="..." term)
  • Spacing between border and contents: use cellpadding. For some reason it doesn't seem to work inside the style="..." term, so use it in this form: cellpadding="10"

Applying wikitable, float right and margin in a simple table looks like this:

{| class="wikitable" style="float:right; margin:.5em"
|-
!Header column 1 
!Header column 2 
|-
|cell 1
|cell 2
|}

Which displays like this (note that the following text wraps around the table):


Header column 1 Header column 2
cell 1 cell 2

Dummy text... Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris interdum augue ut dui lobortis vitae pellentesque sem ornare. Proin sodales lectus nec erat semper hendrerit. Aenean pulvinar quam eu purus vehicula euismod. Etiam et magna leo. Vivamus eu metus vel leo sodales sollicitudin. Curabitur porttitor rutrum quam ac gravida. In eget tristique nisi. Pellentesque nulla sapien, pulvinar ultricies egestas sit amet, porttitor non leo.


For more formatting options, see Help:Notices.

Sortable table[edit]

Sortable tables can be created by using class="wikitable sortable". As shown in the following example:

{| class="wikitable sortable"
|-
! Run # 
! Temperature (°F) 
! Humidity (%)
|-
| 1 
| 78 
| 42
|-
| 2 
| 76 
| 55
|-
| 3 
| 74 
| 41
|}
that creates (notice the sort buttons next to the headings)
Run # Temperature (°F) Humidity (%)
1 78 42
2 76 55
3 74 41

More info[edit]