More actions
mNo edit summary |
update doc for template changes. |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
; Description | |||
: This template creates a colored text box. | |||
This template creates a colored text box | |||
; Dependencies | |||
:; Used by | |||
:: {{T|Example}} | |||
:: {{T|Important note box}} | |||
:: {{T|Note box}} | |||
== | ; Syntax | ||
: {{T|Color box|3= content|4= border= color|5= width= percentage|6= color= color|7= align= position|8= text= color|9= italics= no}} | |||
:; Parameters | |||
:: All named parameters, with an = in the syntax, are optional. | |||
::; content : The contents of the box. This can be as long or short as necessary, and wiki formatting (such as bold text or links) works just fine. '''Note:''' If the text you would like to use include an equals sign (=), you need to explicitly declare your text as a numbered parameter (i.e. put 1= before your text), otherwise the template will display nothing. | |||
::; border : Sets the border color of the box. The default is set to a shade of {{Co|#888888|gray}}. Colors can be given either by color name<ref>https://www.w3schools.com/cssref/css_colors.asp [2021-10-23]</ref> (e.g. {{Co|red|red}} or {{Co|green|green}}) or values<ref>https://www.w3schools.com/cssref/css_colors_legal.asp [2021-10-23]</ref> (like {{Co|#0000FF|#FF0000}}). | |||
::; width : Sets the width of the box. It's recommended to set this as a percentage (of the paragraph width), so <code>50%</code> will produce a text box half as wide as the surrounding paragraph. If omitted, the text box will be as wide as the surrounding paragraph. When width is set to less than <code>100%</code>, the box will be centered. | |||
::; color : Sets the background color of the box. The default is set to transparent. For valid values see border | |||
::; align : Sets the position of the text within the box. The default is set to left. Values are: left, center, right or justify. | |||
::; text : Sets the text color of the box. The default is set to inherit. For valid values see border. | |||
::; italics : Set italics= no to override the default of the contents of the box being in italics. Otherwise omit. | |||
; Usage notes | |||
: Make sure the colors used work both for light and dark mode. | |||
; Examples | |||
: {{Code|<nowiki>{{Color box|A very basic text box}}</nowiki>: gives ...}} | |||
{{Color box|A very basic text box}} | {{Color box|A very basic text box}} | ||
: {{code|<nowiki>{{Color box|color= #144f1d|border= #2f8f2f|A more colorful box!}}</nowiki>: gives ...}} | |||
{{Color box|color=#144f1d|border=#2f8f2f|A more colorful box!}} | {{Color box|color= #144f1d|border= #2f8f2f|text= yellow|A more colorful box!}} | ||
: {{Code|<nowiki>{{Color box|color= #110033|border= #6600bb|width=50%|A smaller, purple box}}</nowiki>: gives ...}} | |||
{{Color box|color= #110033|border= #6600bb|text= LightSkyBlue|width=50%|A smaller, purple box}} | |||
: {{Code|<nowiki>{{Color box|color= #66FFFF|border= #6600FF|text= black|A light blue box with dark text}}</nowiki>: gives ...}} | |||
{{Color box|color=# | {{Color box|color= #66FFFF|border= #6600FF|text= black|A light blue box with dark text}} | ||
< | ; References | ||
<References /> | |||
<includeonly>[[Category:Formatting templates]]</includeonly> | <includeonly>[[Category:Formatting templates]]</includeonly> | ||
<noinclude>[[Category:Template documentation]]</noinclude> | <noinclude>[[Category:Template documentation]]</noinclude> | ||
Latest revision as of 11:40, 14 May 2025
- Description
- This template creates a colored text box.
- Dependencies
-
- Used by
- {{Example}}
- {{Important note box}}
- {{Note box}}
- Syntax
- {{Color box|<content>|<border= color>|<width= percentage>|<color= color>|<align= position>|<text= color>|<italics= no>}}
- Parameters
- All named parameters, with an = in the syntax, are optional.
- content
- The contents of the box. This can be as long or short as necessary, and wiki formatting (such as bold text or links) works just fine. Note: If the text you would like to use include an equals sign (=), you need to explicitly declare your text as a numbered parameter (i.e. put 1= before your text), otherwise the template will display nothing.
- border
- Sets the border color of the box. The default is set to a shade of gray. Colors can be given either by color name[1] (e.g. red or green) or values[2] (like #FF0000).
- width
- Sets the width of the box. It's recommended to set this as a percentage (of the paragraph width), so
50%will produce a text box half as wide as the surrounding paragraph. If omitted, the text box will be as wide as the surrounding paragraph. When width is set to less than100%, the box will be centered. - color
- Sets the background color of the box. The default is set to transparent. For valid values see border
- align
- Sets the position of the text within the box. The default is set to left. Values are: left, center, right or justify.
- text
- Sets the text color of the box. The default is set to inherit. For valid values see border.
- italics
- Set italics= no to override the default of the contents of the box being in italics. Otherwise omit.
- Usage notes
- Make sure the colors used work both for light and dark mode.
- Examples
{{Color box|A very basic text box}}: gives ...
{{Color box|color= #144f1d|border= #2f8f2f|A more colorful box!}}: gives ...
{{Color box|color= #110033|border= #6600bb|width=50%|A smaller, purple box}}: gives ...
{{Color box|color= #66FFFF|border= #6600FF|text= black|A light blue box with dark text}}: gives ...
- References
- ^ https://www.w3schools.com/cssref/css_colors.asp [2021-10-23]
- ^ https://www.w3schools.com/cssref/css_colors_legal.asp [2021-10-23]