Template:Var/doc: Difference between revisions
Jump to navigation
Jump to search
Line 42: | Line 42: | ||
| {{code|style}} || {{tlc|var|style{{=}}color:green;background-color:#fff0d0;|This variable has been styled}} || {{var|style=color:green;background-color:#fff0d0;|This variable has been styled}} | | {{code|style}} || {{tlc|var|style{{=}}color:green;background-color:#fff0d0;|This variable has been styled}} || {{var|style=color:green;background-color:#fff0d0;|This variable has been styled}} | ||
|- | |- | ||
| Wiki-formatting || {{tlc|var|<nowiki>You ''can'' '''use''' {{sup|wiki}} <big>markup</big> (italic is preset)</nowiki>}} || {{var|You ''can'' '''use''' {{sup|wiki}} <big>markup</big> (italic is preset)}} | | Wiki-formatting || {{tlc|var|<nowiki>You ''can'' '''use''' {{sup|wiki}} <big>markup</big> (italic is preset)</nowiki>}} || {{var|You ''can'' '''use''' {{sup|wiki}} <big>markup</big> (italic is preset and can't be inverted)}} | ||
|} | |} | ||
Revision as of 14:51, 4 January 2015
Usage
{{var}} is a front-end for the HTML element <var>
, which is used to denote a variable.
Parameters
There are 2 parameters, of which 1 is unnamed and required, and 1 is named and optional.
Syntax
The template's syntax is
{{var|custom text}}
Required parameter
1
- Custom text
The variable you wish to enclose in <var>
tags.
- Usage
{{var|1}}
Optional parameter
style
- Custom text styling
You can override the default output styling by using this parameter to specify CSS properties with appropriate values.
- Note
- When entering the CSS properties and values, use the normal format, separating the property from its value with a colon (:), and ending each property:value pair with a semicolon (;), e.g.
css-property-1:value; css-property-2:value; css-property-3:value;
. But, don't enclose the entry in double quotation marks ("…"). That is done automatically.
- Usage
{{var|1|style=prop1:valueA; prop2:valueB;}}
Examples
Correct use
Case | What you type | What you see |
---|---|---|
Basic use | {{var|variable}} |
variable |
In inline text | If {{var|E}} = {{var|m c2}} , then what is F? |
If E = m c2, then what is F? |
style |
{{var|style=color:green;background-color:#fff0d0;|This variable has been styled}} |
This variable has been styled |
Wiki-formatting | {{var|You ''can'' '''use''' {{sup|wiki}} <big>markup</big> (italic is preset)}} |
You can use wiki markup (italic is preset and can't be inverted) |
See also
- {{varserif}}: inserts
<var>
tags with serif font styling.
- {{abbr}}: inserts
<abbr>
tags to include a tooltip explanation of an abbreviation. - {{bdi}}: inserts
<bdi>
tags to allow for inline changes in text direction. - {{bdo}}: inserts
<bdo>
tags, forcing inline changes in text direction. - {{code}}: inserts
<code>
tags. - {{mark}}: inserts
<mark>
tags, highlighting the enclosed text. - {{samp}}: inserts
<samp>
tags.