Difference between revisions of "Template:Style"
Jump to navigation
Jump to search
(Created page with "<noinclude> To copy: <pre>{{Style|text=|css=|allign=}}</pre> Examples: ---- 1. '''<nowiki>{{Style|text=Some note|css=color: #8B4513; background: #FFE4B5;|allign=}}</nowiki>'...") |
|||
Line 1: | Line 1: | ||
− | <noinclude> | + | <noinclude>This template applies CSS rules to the text and treats it as a block if '''allign''' parameter is set. |
To copy: | To copy: | ||
<pre>{{Style|text=|css=|allign=}}</pre> | <pre>{{Style|text=|css=|allign=}}</pre> | ||
− | Examples | + | If '''allign''' is set, then '''text''' will be wrapped in '''<nowiki><div></nowiki>''' tag and handled as a block, otherwise it keeps inline arrangement. |
− | + | ||
+ | |||
+ | == Examples == | ||
+ | |||
1. '''<nowiki>{{Style|text=Some note|css=color: #8B4513; background: #FFE4B5;|allign=}}</nowiki>''': | 1. '''<nowiki>{{Style|text=Some note|css=color: #8B4513; background: #FFE4B5;|allign=}}</nowiki>''': | ||
− | {{Style | + | {{Style|Some note|css=color: #8B4513; background: #FFE4B5;}} |
2. '''<nowiki>{{Style|text=Some note|css=|allign=center}}</nowiki>''': | 2. '''<nowiki>{{Style|text=Some note|css=|allign=center}}</nowiki>''': | ||
Line 19: | Line 22: | ||
[[Category: Templates for templates]] | [[Category: Templates for templates]] | ||
</noinclude><includeonly>{{#vardefine:str|{{#tag:span style="{{{css|}}}"|{{{text|}}}}}}}<!-- | </noinclude><includeonly>{{#vardefine:str|{{#tag:span style="{{{css|}}}"|{{{text|}}}}}}}<!-- | ||
+ | -->{{#vardefine:output|{{#var:str}}}}<!-- | ||
-->{{#switch: {{{allign|}}} | -->{{#switch: {{{allign|}}} | ||
− | | left = <div align=left>{{#var:str}}</div> | + | | left = {{#vardefine:output|<div align=left>{{#var:str}}</div>}} |
− | | center = <div align=center>{{#var:str}}</div> | + | | center = {{#vardefine:output|<div align=center>{{#var:str}}</div>}} |
− | | right = <div align=right>{{#var:str}}</div> | + | | right = {{#vardefine:output|<div align=right>{{#var:str}}</div>}} |
− | | #default = {{#var:str}} | + | | #default = {{#vardefine:output|{{#var:str}}}} |
− | }}</includeonly> | + | }}{{#var:output}}</includeonly> |
Revision as of 13:40, 16 June 2020
This template applies CSS rules to the text and treats it as a block if allign parameter is set.
To copy:
{{Style|text=|css=|allign=}}
If allign is set, then text will be wrapped in <div> tag and handled as a block, otherwise it keeps inline arrangement.
Examples
1. {{Style|text=Some note|css=color: #8B4513; background: #FFE4B5;|allign=}}:
2. {{Style|text=Some note|css=|allign=center}}:
Some note
3. {{Style|text=Some note|css=|allign=right}}:
Some note