跳转到内容

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

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

这是本页的一个历史版本,由Taiwania Justo留言 | 贡献2018年12月27日 (四) 06:48 建立内容为“{{intro to| In general, it is recommended that tables simply use Wikipedia's default formatting. In some circumstances, however, you…”的新页面)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)


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

編輯表格
表格的基礎

擴張表格
增加列與欄

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

進階格式
使用HTML

總結
回顧您所學到的技巧




In general, it is recommended that tables simply use Wikipedia's default formatting. In some circumstances, however, you may need to apply some more complicated formatting using CSS. The appearance of each cell can be controlled by adding style=" " | before the cell's contents. CSS formatting is added to headings and captions in the same way.

Any CSS attributes can be added in the 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 -->