Difference between revisions of "Template:Legend striped"
Jump to navigation
Jump to search
imported>Primefac m (Protected "Template:Legend striped": semi-protection of high-usage templates to combat systematic vandalism ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite))) |
imported>Nihiltres (Updated from sandbox; new version doesn't break horribly if it shares the page with another kind of legend template, and matches better with them) |
||
Line 1: | Line 1: | ||
− | <includeonly><div class="legend"><span class="legend-color" style=" | + | <includeonly><!-- |
− | {{Documentation}} | + | --><templatestyles src="Legend/styles.css" /><!-- |
− | </noinclude> | + | --><div class="legend"><!-- |
+ | --><span class="legend-color" style="<!-- | ||
+ | -->{{#if:{{{border|}}}|border:{{{border}}};|{{#if:{{{outline|}}}|border:1px solid {{{outline}}};}}}}<!-- | ||
+ | -->{{#if:{{{2|}}}|background-color:{{{2}}};}}<!-- | ||
+ | -->{{#if:{{{textcolor|}}}|color:{{{textcolor}}};}}<!-- | ||
+ | -->"><!-- | ||
+ | --><span <!--class="legend-color-inner"--> style="<!-- | ||
+ | -->display:inline-block; width:0.1em; height:0em;<!-- | ||
+ | -->border-{{#if:{{{up|}}}|left|right}}: 1.25em solid {{{1|transparent}}};<!-- | ||
+ | -->border-bottom: 1.25em solid {{{2|transparent}}};<!-- | ||
+ | -->">{{#if:{{{text|}}}|<span class="legend-text" style="position:relative; top:0; left:0;">{{{text}}}</span>| }}<!-- | ||
+ | --></span></span> {{{3|}}}<!-- | ||
+ | --></div></includeonly><noinclude>{{Documentation}}</noinclude> |
Revision as of 23:10, 3 October 2020
Script error: No such module "Uses TemplateStyles". Shows a legend row with a two colored box. Complementary to the one color legend template.
Usage
{{Legend striped|top color|bottom color|label|outline=outline color|border=css border}}
- top color and bottom color are passed to the css background-color property of the color box. These fields are required.
- label is optional, and adds text to the right of the box. Text may be ''italic'', '''bold''', or [[wikilinked]] as well.
- The optional outline parameter is the color of the outline around the box.
- If you need to customize the border further, you can use the border argument, which overrides the outline argument and sets the css description (e.g.,
1px solid #aaa
) of the border that will be drawn around the box.
Additionally, editors can specify several other optional fields:
- up: will make the diagonal line go from bottom left to top right. The default is top left to bottom right.
- text: will put one or two characters of text inside the box. If using one character, a non-breaking space (
) will help center it. The color of this text may also be specified with the field textcolor. Will not work with up field.
Examples
Typical use
{{Legend striped|black|gray|Oakland}} {{Legend striped|green|gold|Green Bay}} {{Legend striped|purble|black|''Baltimore''|up=yes}} {{Legend striped|#003b7b|#fff|'''Indianapolis'''|outline=silver}} {{Legend striped|#c80815|#e6be8a|[[San Francisco]]|border=2px solid black}}
Oakland
Green Bay
Baltimore
Indianapolis
Advanced use
{{Legend striped|#0c2340|#a2aaad|border=3px solid #78be20|Seattle}} {{Legend striped|white|gold|border=3px solid maroon|text='''F'''|textcolor=maroon|Washington}}
Seattle
F Washington
Compatibility
Current compatibility issues are based on different browsers implementation of CSS protocol. These boxes, for example, may look too tall on mobile browsers. Please let the developers know on the talk page if there are issues.
The above documentation is transcluded from Template:Legend striped/doc. (edit | history) Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. Please add categories to the /doc subpage. Subpages of this template. |