Template:Column style
外观
| 本模板使用以下模板样式: |
该模板允许在不重复代码的情况下为表格列应用一些标准样式。
用法
[编辑]放置{{Column style}}在表格之前,然后在表格的class中加入ts-columnstyle-left-效果参数-列数。
列数之前为两个短横(ts-columnstyle-left-效果参数--列数)时指定倒数的列数。
| 效果参数 | 效果 | CSS代码 |
|---|---|---|
| left | 左对齐 | text-align:left; |
| center | 居中对齐 | text-align:center; |
| right | 右对齐 | text-align:right; |
| italic | 斜体 | font-style:italic; |
| bold | 加粗 | font-weight:bold; |
| nowrap | 不换行 | white-space: nowrap; |
| increment | 自动编号 | content: counter(row-num); |
| small | 小号字体 | font-size: 85%; |
| large | 大号字体 | font-size: large; |
示例
[编辑]
{{Column style}}
{| class="wikitable ts-columnstyle-bold-2"
! 1 !! 2 !! 3
|-
| 11 || 12 || 13
|-
| 21 || 22 || 23
|-
| 31 || 32 || 33
|}
|
→ |
|
{{Column style}}
{| class="wikitable sortable ts-columnstyle-increment-1"
! class="unsortable" | № !! 1 !! 2 !! 3
|-
| || 11 || 32 || 13
|-
| || 21 || 22 || 23
|-
| || 31 || 12 || 33
|}
|
→ |
|
参见
[编辑]- {{Table alignment}}
- {{shy}} – Can be used to help narrow columns by adding a soft hyphen to a word to allow it to wrap.
- {{sticky header}} - Makes column headers stick to the top of the page while scrolling through table data.
- {{sort under}} - moves the sorting arrows under the headers.
- {{row hover highlight}} - adds row hover highlighting, and option for white background.
- {{static row numbers}} - adds a column of row numbers to a table.