Help:Editing Tables

From Camera-wiki.org
Revision as of 10:04, 24 April 2011 by U. kulick (talk | contribs) (Created page with "===Tables=== The "code" <div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf;"> <nowiki>{|</nowiki><br /> ! Header 1<br /> ! Header 2<br /> |...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tables

The "code"

{|
! Header 1
! Header 2
|-
| row 1, cell 1
| row 1, cell 2
|-
| row 2, cell 1
| row 2, cell 2
|}

produces

Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

Another simple style with borders and caption starts with

{|class="wikitable"
|+caption

, giving

caption
Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2


refined table design

Is more control needed? Then let’s replace the initial “|” of the table fields with "||". Between the two upright lines normal HTML attributes can be applied for alignment, background color and more. The general attributes for the whole table are just added after the table's initial "{|".

{|class="toccolours" border="1" style="clear:both; background-color:#e0e0e0; margin:2em auto; text-align:center; border-collapse:collapse;"
! longer Header 1
! longer Header 2
! longer Header 3
|-
|bgcolor=yellow| row 1,<br /> cell 1
|valign=bottom bgcolor=lightpink| row 1, cell 2
|rowspan=2 valign=center| high cell
|-
|align=left bgcolor=lightgreen| row 2, cell 1
|align=right bgcolor=cyan| row 2, cell 2
|-
|colspan=2| wide cell
|| row 3, cell 2

|}

The first "|-" is omitted for briefness. The result is now:

longer Header 1 longer Header 2 longer Header 3
row 1,
cell 1
row 1, cell 2 high cell
row 2, cell 1 row 2, cell 2
wide cell row 3, cell 2