跳转到内容

Help:使用維基標記式語言增修表格/5

维基百科,自由的百科全书

这是本页的一个历史版本,由Taiwania Justo留言 | 贡献2018年12月27日 (四) 07:57 (// Edit via Wikiplus)编辑。这可能和当前版本存在着巨大的差异。


表格簡介
何謂表格與如何運作

編輯表格
表格的基礎

擴張表格
增加列與欄

可排序表格
給讀者更多選擇

進階格式
使用HTML

總結
回顧您所學到的技巧




一般而言,我們建議表格僅以維基百科的預設格式設定即可。然而在部分情況下,您會需要使用更複雜的格式,這些格式可由CSS來進行實作。每個表格格子的呈現方式都在格子內容之前增加style=" " |來加以控制。同樣,CSS格式也可以在表格標題與表頭處以同樣方式進行添加。

任何的CSS屬性可以在style=" " |進行添加。

最常用屬性
屬性 意義 範例
background 填滿背景與指定背景顏色 background:yellow
color 文字顏色 color:blue
width 格子寬度 width:100px
border-width 邊界寬度 border-width:3px
text-align 格子內的文字排列 text-align:center

As an example, here's an example with some varied formatting added to specific cells

{| class="wikitable"
|+ Caption: some cells yellow.
|-
! Header1
! Header2
! Header3
|-
| style="background: yellow" | R1C1
| R1C2
| style="background: yellow" | R1C3
|-
| R2C1
| style="background: yellow" | R2C2
| R2C3
|}

Then it would produce this:

說明:部分儲存格為黃色。
表頭1 表頭2 表頭3
R1C1 R1C2 R1C3
R2C1 R2C2 R2C3


CSS attributes can be added to the whole table by editing the first line of the table using {| style=" " in the first line. Similarly, attributes can be added to a row using |- style=" " The example below would fill the whole table yellow.

{| class="wikitable" style="background: yellow"


All of these formatting options should be used sparingly. Tables in crazy colours are hard to read.


隱藏式註解

In complicated tables, sometimes hidden comments can be useful to explain formatting. These hidden comments are only visible when editing the page, not when reading it normally. Comments can be added by placing them between <!-- and -->.

| R1C1 || R1C2 ||R1C3 <!-- Hidden comment to explain this row -->