Template:Background/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Doc/subpage}}__NOTOC__
{{Doc/subpage}}__NOTOC__
This template allows you to add a background for an article.
This template allows you to add a background for an article.
== Usage ==
This template is usually written in a column. To use it, insert <code><nowiki>{{Background}}</nowiki></code> on the desired page and specify the [[#Parameters and Examples|parameters]] under the template name in the following format:
<pre>
{{Background
| parameter 1 = value
| parameter 2 = value
}}
</pre>


== Parameters and Examples ==
== Parameters and Examples ==
{| class="standard-table" width="100%"
{| class="standard-table" width="100%"
! width="15%" | Name
! style="width:12%" | Name
! width="30%" | Description
! style="width:48%" | Description
! Example
! Example
! width="13%" | Preview
! style="width:8%" | Preview
|-
|-
| align="center" | {{Code|{{Param|file}}}}
| style="text-align:center" | <code>{{param|file}}</code>
| The path to the image.
| The path to the image.
| {{CodeBlock|<nowiki>{{Background
| style="background-color:#1f1f1f" | <pre style="margin:0">| file = Hlalyx1.jpg</pre>
| file = Hlalyx1.jpg
| rowspan="6" style="background-color:#262626; text-align:center; vertical-align:top" | See [[Template:Background/sandbox|Sandbox]].
}}</nowiki>}}
| align="center" | Preview is not possible
|-
|-
| align="center" | {{Code|{{Param|opacity}}}}
| style="text-align:center" | <code>{{param|opacity}}</code>
| Allows you to change the opacity of the entire block.
| Allows you to change the opacity of the entire block.
({{Code|style=1|select=1|0.05}} by default)
(<code>0.05</code> by default)
| {{CodeBlock|<nowiki>{{Background|opacity=0.5}}</nowiki>}}
| style="background-color:#1f1f1f" | <pre style="margin:0">| opacity = 0.5</pre>
| align="center" | Preview is not possible
|-
|-
| align="center" | {{Code|{{Param|bgcolor}}}}
| style="text-align:center" | <code>{{param|bgcolor}}</code>
| Controls the background color of the block.
| Controls the background color of the block.
({{Code|style=1|select=1|transparent}} by default)
(<code>transparent</code> by default)
| {{CodeBlock|<nowiki>{{Background|bgcolor=rgb(255,255,255)}}</nowiki>}}
| style="background-color:#1f1f1f" | <pre style="margin:0">| bgcolor = rgb(255,255,255)</pre>
| align="center" | Preview is not possible
|-
|-
| align="center" | {{Code|{{Param|gradient-color}}}}
| style="text-align:center" | <code>{{param|gradient-color}}</code>
| Controls the color of the bottom gradient.
| Controls the color of the bottom gradient.
({{Code|style=1|select=1|38,38,38}} by default)
(<code>38,38,38</code> by default)
| {{CodeBlock|<nowiki>{{Background|gradient-color=50,50,50}}</nowiki>}}
| style="background-color:#1f1f1f" | <pre style="margin:0">| gradient-color = 50,50,50</pre>
| align="center" | Preview is not possible
|-
|-
| align="center" | {{Code|{{Param|gradient-height}}}}
| style="text-align:center" | <code>{{param|gradient-height}}</code>
| Controls the height of the gradient.
| Controls the height of the gradient.
({{Code|style=1|select=1|150px}} by default)
(<code>150px</code> by default)
| {{CodeBlock|<nowiki>{{Background|gradient-height=600px}}</nowiki>}}
| style="background-color:#1f1f1f" | <pre style="margin:0">| gradient-height = 600px</pre>
| align="center" | Preview is not possible
|-
|-
| align="center" | {{Code|{{Param|mode}}}}
| style="text-align:center" | <code>{{Param|mode}}</code>
| Controls the position of the background image on the page.
| Controls the position of the background image on the page.
* <code>0</code> &ndash; Absolute ''(default)'': Always at the top of the page.
* <code>0</code> &ndash; Absolute ''(default)'': Always at the top of the page.
* <code>1</code> &ndash; Static: The regular position where the template occurs in the wikitext
* <code>1</code> &ndash; Static: The regular position where the template occurs in the wikitext
* <code>2</code> &ndash; Sticky: Like static, but the image follows the user when scrolling about, until the containing block (such as a simple <code>&lt;div&gt;</code>) ends.
* <code>2</code> &ndash; Sticky: Like static, but the image follows the user when scrolling about, until the containing block (such as a simple <code>&lt;div&gt;</code>) ends.
| {{CodeBlock|<nowiki>{{Background|mode=1}}</nowiki>}}
| style="background-color:#1f1f1f" | <pre style="margin:0">| mode = 1</pre>
| align="center" | Preview is not possible
|}
|}



Revision as of 15:27, 26 September 2025

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

This template allows you to add a background for an article.

Usage

This template is usually written in a column. To use it, insert {{Background}} on the desired page and specify the parameters under the template name in the following format:

{{Background
| parameter 1 = value
| parameter 2 = value
}}

Parameters and Examples

Name Description Example Preview
{{{file}}} The path to the image.
| file = Hlalyx1.jpg
See Sandbox.
{{{opacity}}} Allows you to change the opacity of the entire block.

(0.05 by default)

| opacity = 0.5
{{{bgcolor}}} Controls the background color of the block.

(transparent by default)

| bgcolor = rgb(255,255,255)
{{{gradient-color}}} Controls the color of the bottom gradient.

(38,38,38 by default)

| gradient-color = 50,50,50
{{{gradient-height}}} Controls the height of the gradient.

(150px by default)

| gradient-height = 600px
{{{mode}}} Controls the position of the background image on the page.
  • 0 – Absolute (default): Always at the top of the page.
  • 1 – Static: The regular position where the template occurs in the wikitext
  • 2 – Sticky: Like static, but the image follows the user when scrolling about, until the containing block (such as a simple <div>) ends.
| mode = 1