Таблицы

Материал из Записки
Перейти к: навигация, поиск

Красивые таблички

Для создания красивых табличек целесообразно использовать шаблоны. Например создадим шаблон таблички:

{{prettytable}}
 border="2" width="{{{width|100%}}}" cellspacing="4" cellpadding="3" rules="all" style="margin:1em 1em 1em 0; border:solid 1px #AAAAAA; border-collapse:collapse;empty-cells:show;{{{style|}}}"
 <noinclude>[[Category:Utility templates|{{PAGENAME}}]]</noinclude>
Hl2
 bgcolor="#A7C1F2" <noinclude>[[Category:Utility templates|{{PAGENAME}}]]</noinclude>

Теперь нарисуем саму табличку:

{|{{prettytable}}
 !{{Hl2}}|Name	
 !{{Hl2}}|Value
 !{{Hl2}}|Description
 
 |-
 |auto-links
 |true
 |Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won’t be clickable. Click here for a demo.
 
 |-
 |class-name
 |''
 |Allows you to add a custom class (or multiple classes) to every highlighter element that will be created on the page. Click here for a demo.
 
 |}
Шаблон:Hl2|Name Шаблон:Hl2|Value Шаблон:Hl2|Description
auto-links true Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won’t be clickable. Click here for a demo.
class-name Allows you to add a custom class (or multiple classes) to every highlighter element that will be created on the page. Click here for a demo.

Таблицы с сортировкой по столбцам

Для включения возможности сортировки таблицы по столбцам, достаточно просто добавить class=sortable.

{| class=sortable
 !{{Hl2}}|Name	
 !{{Hl2}}|Value
 !{{Hl2}}|Description
 
 |-
 |auto-links
 |true
 |Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won’t be clickable. Click here for a demo.
 
 |-
 |class-name
 |''
 |Allows you to add a custom class (or multiple classes) to every highlighter element that will be created on the page. Click here for a demo.
 
 |}
Шаблон:Hl2|Name Шаблон:Hl2|Value Шаблон:Hl2|Description
auto-links true Allows you to turn detection of links in the highlighted element on and off. If the option is turned off, URLs won’t be clickable. Click here for a demo.
class-name Allows you to add a custom class (or multiple classes) to every highlighter element that will be created on the page. Click here for a demo.