Template:Table/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (typo fix)
 
(18 intermediate revisions by 3 users not shown)
Line 2: Line 2:
Adds a table, but actually adds a table.
Adds a table, but actually adds a table.


{{ModernNote|Work is suspended. It seems that the creator of the template has done everything that is needed, but the template can still change a lot in the future.}}
== Parameters and Examples ==
{{Todo|Make the documentation better.}}
{| class="standard-table" style="width:100%"
|- style="position:sticky; z-index:10; top:0"
! style="width:17em" | Parameter
! Description
! Example
|-
| style="text-align:center" | {{Code|preset=1|{{param|1}}}} or {{Code|preset=1|{{param|text}}}}
| Your text.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|Hello, World!}}</nowiki>}} {{CodeBlock|<nowiki>{{Table|text = Hello, World!}}</nowiki>}}
|-
| colspan="3" style="background-color:#858585; text-align:center" |
==== <span style="color:#000"> Elements </span> ====
|-
| style="text-align:center" | {{Code|preset=1| {{param|caption}} }}
| Table caption.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|caption = Hello, World!}}</nowiki>}}
|-
| colspan="3" style="background-color:#858585; text-align:center" |


== Parameters ==
==== <span style="color:#000"> Attributes </span> ====
* {{Param|id}} - Element ID for links.
|-
| style="text-align:center" | {{Code|preset=1| {{param|id}} }}
| Element ID. Useful for linking to a specific part of the page.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|id = my_id}}</nowiki>}} {{CodeBlock|<nowiki>[[My Sweet Page#my_id|My sweet page]]</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|class}} }}
| Custom HTML class.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|class = myClass}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|style}} }}
| Custom CSS.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|style = background-image:linear-gradient(0deg, white, black)}}</nowiki>}}
|-
| colspan="3" style="background-color:#858585; text-align:center" |


* {{Param|width}} - Element width.
==== <span style="color:#000"> Style </span> ====
* {{Param|caption}} - Table caption (Not available for {{Code|<nowiki>{{Table|tr}}</nowiki>}}, {{Code|<nowiki>{{Table|th}}</nowiki>}} and {{Code|<nowiki>{{Table|td}}</nowiki>}}.).
|-
* {{Param|tr}} - {{Code|&#60;tr>&#60;/tr>}}
| style="text-align:center" | {{Code|preset=1| {{param|caption indent}} }}
* {{Param|th}} - {{Code|&#60;th>&#60;/th>}}
| Indentation of the caption from all sides.
* {{Param|td}} - {{Code|&#60;td>&#60;/td>}}
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|caption indent = 1em 2em 3em 4em}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|caption indent:top}} }}
| Indentation of the caption at the top
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|caption indent:top = 1em}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|caption indent:right}} }}
| Indentation of the caption on the right.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|caption indent:right = 2em}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|caption indent:bottom}} }}
| Indentation of the caption at the bottom.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|caption indent:bottom = 3em}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|caption indent:left}} }}
| Indentation of the caption on the left.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|caption indent:left = 4em}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|width}} }}
| The width of the cell.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|width = 30%}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|bgcolor}} }}
| Background color.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|bgcolor = rgb(255 255 255)}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|radius}} }}
| The radius of the cell border.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|radius = 8px 2px 4px 8px}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|align}} }}
| Table alignment. Available values:
* {{Code|<nowiki>center</nowiki>}}
* {{Code|<nowiki>right</nowiki>}}
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|align = right}}</nowiki>}}
|-
| style="text-align:center" | {{Code|preset=1| {{param|font-size}} }}
| Font size.
| style="padding:.2em .5em" | {{CodeBlock|<nowiki>{{Table|font-size = 1.5em}}</nowiki>}}
|}


* {{Param|colspan}} - {{Todo}}
== Ready-made table code ==
* {{Param|cellpadding}} - {{Todo}}
* {{Param|bgcolor}} - Background color.
* {{Param|radius}} - The radius of the cell border.
* {{Param|font-size}} - Font size.
 
* {{Param|align}} - Alignment of a table or text.
* {{Param|color}} - Color of the text.
* {{Param|class}} - Custom HTML class.
* {{Param|style}} - Custom CSS (prepared styles are also planned).
 
== Example ==
{{CodeBlock|<nowiki>{{Table
{{CodeBlock|<nowiki>{{Table
| align = center
| align = center
| caption = <span style="user-select:none"> [[File:ValveEmployee.png|link = Valve]] </span>
| caption = <span style="user-select:none"> [[File:ValveEmployee.png|link = Valve]] </span>
| caption margin:bottom = 1em
| caption indent:bottom = 1em
| {{Table|tr
| {{tr
| {{Table|th|radius=3px 0 0 0| Header 1 }} {{Table|th| Header 2 }} {{Table|th|radius=0 3px 0 0| Header 3 }}
| {{th|radius=3px 0 0 0| Header 1 }}
  {{th| Header 2 }}
  {{th|radius=0 3px 0 0| Header 3 }}
}}
}}
{{Table|tr
{{tr
| {{Table|td| Cell 1 }} {{Table|td| Cell 2 }} {{Table|td|rowspan=2| Cell 3 }}
| {{td| Cell 1 }}
  {{td| Cell 2 }}
  {{td|rowspan=2| Cell 3 }}
}}
}}
{{Table|tr
{{tr
| {{Table|td|colspan=2|bgcolor=#303030| Cell 4 }}
| {{td|colspan=2|bgcolor=#303030| Cell 4 }}
}}
}}
{{Table|tr
{{tr
| {{Table|td|radius=0 0 0 3px| Cell 6 }} {{Table|td|colspan=2|bgcolor=#303030|radius=0 0 3px 0| Cell 7 }}
| {{td|radius=0 0 0 3px| Cell 6 }}
  {{td|colspan=2|bgcolor=#303030|radius=0 0 3px 0| Cell 7 }}
}}
}}
}}</nowiki>}}
}}</nowiki>}}


{{Table
{{Table
| id = example_table
| align = center
| align = center
| caption = <span style="user-select:none"> [[File:ValveEmployee.png|link = Valve]] </span>
| caption = <span style="user-select:none"> [[File:Valve icon.png|link = Valve]] </span>
| caption margin:bottom = 1em
| caption indent:bottom = 1em
| {{Table|tr
| {{tr
| header = 1
| {{th|radius=3px 0 0 0| Header 1 }}
| {{Table|th|radius=3px 0 0 0| Header 1 }} {{Table|th| Header 2 }} {{Table|th|radius=0 3px 0 0| Header 3 }}
  {{th| Header 2 }}
  {{th|radius=0 3px 0 0| Header 3 }}
}}
}}
{{Table|tr
{{tr
| {{Table|td| Cell 1 }} {{Table|td| Cell 2 }} {{Table|td|rowspan=2| Cell 3 }}
| {{td| Cell 1 }} {{td| Cell 2 }}
  {{td|rowspan=2| Cell 3 }}
}}
}}
{{Table|tr
{{tr
| {{Table|td|colspan=2|bgcolor=#303030| Cell 4 }}
| {{td|colspan=2|bgcolor=#303030| Cell 4 }}
}}
}}
{{Table|tr
{{tr
| {{Table|td|radius=0 0 0 3px| Cell 6 }} {{Table|td|colspan=2|bgcolor=#303030|radius=0 0 3px 0| Cell 7 }}
| {{td|radius=0 0 0 3px| Cell 6 }}
  {{td|colspan=2|bgcolor=#303030|radius=0 0 3px 0| Cell 7 }}
}}
}}
}}
}}

Latest revision as of 15:27, 4 August 2025

Edit-copy.png
This is a documentation subpage for Template:Table.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

Adds a table, but actually adds a table.

Parameters and Examples

Parameter Description Example
{{{1}}} or {{{text}}} Your text.
{{Table|Hello, World!}}
{{Table|text = Hello, World!}}

Elements

{{{caption}}} Table caption.
{{Table|caption = Hello, World!}}

Attributes

{{{id}}} Element ID. Useful for linking to a specific part of the page.
{{Table|id = my_id}}
[[My Sweet Page#my_id|My sweet page]]
{{{class}}} Custom HTML class.
{{Table|class = myClass}}
{{{style}}} Custom CSS.
{{Table|style = background-image:linear-gradient(0deg, white, black)}}

Style

{{{caption indent}}} Indentation of the caption from all sides.
{{Table|caption indent = 1em 2em 3em 4em}}
{{{caption indent:top}}} Indentation of the caption at the top
{{Table|caption indent:top = 1em}}
{{{caption indent:right}}} Indentation of the caption on the right.
{{Table|caption indent:right = 2em}}
{{{caption indent:bottom}}} Indentation of the caption at the bottom.
{{Table|caption indent:bottom = 3em}}
{{{caption indent:left}}} Indentation of the caption on the left.
{{Table|caption indent:left = 4em}}
{{{width}}} The width of the cell.
{{Table|width = 30%}}
{{{bgcolor}}} Background color.
{{Table|bgcolor = rgb(255 255 255)}}
{{{radius}}} The radius of the cell border.
{{Table|radius = 8px 2px 4px 8px}}
{{{align}}} Table alignment. Available values:
  • center
  • right
{{Table|align = right}}
{{{font-size}}} Font size.
{{Table|font-size = 1.5em}}

Ready-made table code

{{Table | align = center | caption = <span style="user-select:none"> [[File:ValveEmployee.png|link = Valve]] </span> | caption indent:bottom = 1em | {{tr | {{th|radius=3px 0 0 0| Header 1 }} {{th| Header 2 }} {{th|radius=0 3px 0 0| Header 3 }} }} {{tr | {{td| Cell 1 }} {{td| Cell 2 }} {{td|rowspan=2| Cell 3 }} }} {{tr | {{td|colspan=2|bgcolor=#303030| Cell 4 }} }} {{tr | {{td|radius=0 0 0 3px| Cell 6 }} {{td|colspan=2|bgcolor=#303030|radius=0 0 3px 0| Cell 7 }} }} }}