假设我们想在像 Wikipedia
这样的网站上创建一个表格什么源代码会产生如下所示的表格?:
水果 | 非水果蔬菜 |
---|---|
黄瓜水果 | 菠菜叶和茎 |
番茄水果 | 菠菜叶和茎 |
西葫芦水果 | 芹菜叶和茎 |
苹果水果 | 土豆根 |
橙子水果 | 洋葱根 |
胡萝卜根 |
这个问题的正确答案是一个有效的表格源代码示例。
我们不需要一页又一页的文档或解释,只需要工作的功能代码。
以下代码不正确,包含一些错误:
{| class="wikitable"
|+ Title Goes Here.
|-
! Fruit
! NonFruitVegetable
|-
| CucumberFruit
| TomatoFruit
| ZucchiniFruit
| AppleFruit
| OrangeFruit
|-
| SpinachLeavesandStems
| CeleryLeavesandStems
| PotatoRoot
| OnionRoot
| CarrotRoots
|}
如你所愿:
{| class="wikitable"
|+ Title Goes Here.
|-
! Fruit
! NonFruitVegetable
|-
| CucumberFruit
| SpinachLeavesandStems
|-
| TomatoFruit
| SpinachLeavesandStems
|-
| ZucchiniFruit
| CeleryLeavesandStems
|-
| AppleFruit
| PotatoRoot
|-
| OrangeFruit
| OnionRoot
|-
|
| CarrotRoots
|}
维基文本 | HTML 等效(大致) |
---|---|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|