Reputation: 4644
Suppose that we wanted to create a table on a website like Wikipedia
What source code would produce a table such as the one shown below?:
Fruit | NonFruitVegetable |
---|---|
CucumberFruit | SpinachLeavesandStems |
TomatoFruit | SpinachLeavesandStems |
ZucchiniFruit | CeleryLeavesandStems |
AppleFruit | PotatoRoot |
OrangeFruit | OnionRoot |
CarrotRoots |
A correct answer to this question would an example of valid source code for a table.
We don't want pages and pages of documentation or explanation, just working functional code.
The following code is incorrect and contains some mistakes:
{| class="wikitable"
|+ Title Goes Here.
|-
! Fruit
! NonFruitVegetable
|-
| CucumberFruit
| TomatoFruit
| ZucchiniFruit
| AppleFruit
| OrangeFruit
|-
| SpinachLeavesandStems
| CeleryLeavesandStems
| PotatoRoot
| OnionRoot
| CarrotRoots
|}
Upvotes: -3
Views: 57
Reputation: 10437
As you wish:
{| class="wikitable"
|+ Title Goes Here.
|-
! Fruit
! NonFruitVegetable
|-
| CucumberFruit
| SpinachLeavesandStems
|-
| TomatoFruit
| SpinachLeavesandStems
|-
| ZucchiniFruit
| CeleryLeavesandStems
|-
| AppleFruit
| PotatoRoot
|-
| OrangeFruit
| OnionRoot
|-
|
| CarrotRoots
|}
Try it on mediawiki.org.
Wikitext | HTML equivalence (roughly) |
---|---|
{| /|} |
<table></table> |
{| class="wikitable" |
<table class="wikitable"> |
|+ |
<caption></caption> |
|+ Foobar |
<caption>Foobar</caption> |
|- |
<tr></tr> |
|- class="row" |
<tr class="row"></tr> |
| |
<td></td> |
| rowspan="2" |
<td rowspan="2"></td> |
Reference: Help:Tables - mediawiki.org
Upvotes: 1