Difference between revisions of "Template:Navbox style"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (Remove interwiki/wikidata reference)
(Merge from /sandbox. {{{color}}} via {{Navbox color}}. Correct "center" to en-us spelling per W3C spec, not en-gb that autocorrect so helpfully provided (I do prefer en-gb, but follow the W3C spec for these things, it's safer for browser compatibility).)
Line 3: Line 3:
 
| child = {{#switch:{{{2}}}
 
| child = {{#switch:{{{2}}}
 
   | body  = width: 100%; background: #fdfdfd;
 
   | body  = width: 100%; background: #fdfdfd;
   | title  = padding: 0.25em 1em; line-height: 1.5em; text-align: centre; background: #ddddff;
+
   | title  = padding: 0.25em 1em; line-height: 1.5em; text-align: center; background: {{Navbox color|{{{color|}}}|2}};
 
   | above
 
   | above
   | below  = padding: 0.25em 1em; line-height: 1.5em; text-align: centre; background: #e6e6ff;
+
   | below  = padding: 0.25em 1em; line-height: 1.5em; text-align: center; background: {{Navbox color|{{{color|}}}|3}};
   | group  = padding: 0.25em 1em; line-height: 1.5em; text-align: centre; white-space: nowrap; text-align: right; background: #e6e6ff;
+
   | group  = padding: 0.25em 1em; line-height: 1.5em; text-align: center; white-space: nowrap; text-align: right; background: {{Navbox color|{{{color|}}}|3}};
 
   | list  = line-height: 1.5em; border-color: #fdfdfd;
 
   | list  = line-height: 1.5em; border-color: #fdfdfd;
 
   | even  = background: #f7f7f7;
 
   | even  = background: #f7f7f7;
Line 13: Line 13:
 
| body  = border: 1px solid #aaa; width: 100%; margin: auto; clear: both; font-size: 88%; text-align: center; padding: 1px; background: #fdfdfd;
 
| body  = border: 1px solid #aaa; width: 100%; margin: auto; clear: both; font-size: 88%; text-align: center; padding: 1px; background: #fdfdfd;
 
| inner  = width: 100%; background: #fdfdfd;
 
| inner  = width: 100%; background: #fdfdfd;
| title  = padding: 0.25em 1em; line-height: 1.5em; text-align: centre; background: #ccccff;
+
| title  = padding: 0.25em 1em; line-height: 1.5em; text-align: center; background: {{Navbox color|{{{color|}}}|1}};
 
| above
 
| above
| below  = padding: 0.25em 1em; line-height: 1.5em; text-align: centre; background: #ddddff;
+
| below  = padding: 0.25em 1em; line-height: 1.5em; text-align: center; background: {{Navbox color|{{{color|}}}|2}};
| group  = padding: 0.25em 1em; line-height: 1.5em; text-align: centre; white-space: nowrap; text-align: right; background: #ddddff;
+
| group  = padding: 0.25em 1em; line-height: 1.5em; text-align: center; white-space: nowrap; text-align: right; background: {{Navbox color|{{{color|}}}|2}};
 
| list  = line-height: 1.5em; border-color: #fdfdfd;
 
| list  = line-height: 1.5em; border-color: #fdfdfd;
 
| even  = background: #f7f7f7;
 
| even  = background: #f7f7f7;
Line 22: Line 22:
 
| navbar = font-weight: normal; white-space: nowrap; line-height: inherit; word-spacing: -0.125em; display: block; font-size: 100%; float: left; text-align: left; margin-right: 0.5em; width: 6em;
 
| navbar = font-weight: normal; white-space: nowrap; line-height: inherit; word-spacing: -0.125em; display: block; font-size: 100%; float: left; text-align: left; margin-right: 0.5em; width: 6em;
 
| navbarfont = font-variant: small-caps;
 
| navbarfont = font-variant: small-caps;
}}
+
}}<noinclude>
<noinclude>
 
 
{{Documentation}}
 
{{Documentation}}
 
<!-- Add categories to the /doc subpage -->
 
<!-- Add categories to the /doc subpage -->
 
</noinclude>
 
</noinclude>

Revision as of 09:29, 9 June 2015

Documentation icon Template documentation[view] [edit] [history] [purge]Pages that link to Template:Navbox style

Usage

This template is not used directly, it is intended for a very specific use, to generate parameters for another highly complex template.

This template provides a mechanism for standard style customisation of {{Navbox}} templates. The site default style comes from MediaWiki:Common.css, and navbox templates should generally use the site default unless they have a good reason to use something else. Currently the style parameter below can be set one of the following:

  • |color=red
  • |color=yellow
  • |color=green
  • |color=cyan
  • |color=blue (the current site default, and only included for completeness)
  • |color=magenta
  • |color=silver

e.g. {{Navbox style|color=green|title}}

It is currently intended to only be used for relatively minor re-styling, such as alternate color schemes. Major changes to the style should really be done via the site CSS.

If you do not wish to customise the style of a navbox, it should not contain any reference to this template.

Top level navboxes

{{Navbox

...

| titlestyle      = {{Navbox style|''style''|title}}
| abovestyle      = {{Navbox style|''style''|above}}
| belowstyle      = {{Navbox style|''style''|below}}
| groupstyle      = {{Navbox style|''style''|group}}

...

}}

Subgroup / child navboxes

{{Navbox|child

...

 | titlestyle      = {{Navbox style|''style''|child|title}}
 | abovestyle      = {{Navbox style|''style''|child|above}}
 | belowstyle      = {{Navbox style|''style''|child|below}}
 | groupstyle      = {{Navbox style|''style''|child|group}}

...
}}

Examples

History

This template was originally a temporary workaround for the CSS missing from MediaWiki:Common.css which was needed to properly support the use of {{Navbox}}. Due to the nature of CSS, it can never be a perfect solution, and is the wrong way to specify the actual layout. The style options being passed to {{Navbox}} exceeded the original design of it, as those options were only ever intended for minor adjustments such as changing the color scheme. Despite that, the usage did provide a short term acceptable solution until the correct CSS was in place. The visual result was broadly similar to that achieved with the correct CSS stylesheet in place. Inline style via the "style" attribute on HTML elements is never a full or correct replacement for a CSS stylesheet, and contains a number of limitations not present for a stylesheet.

The original approximation of the full CSS for {{Navbox}} has been stripped out, but can be found in the template's change history. Remember, it was an imperfect solution, and was only ever intended to be a temporary workaround. It was removed from this template to avoid both current and future conflicts with changes made to the site CSS.