Template:Navbox: Difference between revisions
imported>Sekoia (historical) (importing from wikipedia) |
mNo edit summary Tag: Manual revert |
||
(13 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<!-- | <div role="navigation" aria-labelledby="navbox-{{anchorencode:{{{title}}}}}" class="navbox mw-collapsible {{#ifeq:{{{state|}}}|collapsed|mw-collapsed}}" style="clear: both; position: relative; margin: 1em auto 0; border: 1px solid #aaa; width: 100%; max-width: 150ch; background-color: #f9f9f9; text-align: center; font-size: 90%; {{{style|}}};"><!-- | ||
---Title--- | |||
-->{{ | --><div id="navbox-{{anchorencode:{{{title}}}}}" class="navbox-title" style="margin: 0.2em; padding: 0 6em; font-weight: bold; {{{basestyle|}}}; {{{titlestyle|}}};"><!-- | ||
-->{{{title}}}<!-- | |||
--></div><!-- | |||
-- | ---Navbar--- | ||
--><div style="position: absolute; top: 0.5em; left: 1em;"><!-- | |||
-->{{Tnavbar|{{{name}}}|fontstyle={{{basestyle|}}};{{{titlestyle|}}};border:none;|mini=1}}<!-- | -->{{Tnavbar|{{{name}}}|fontstyle={{{basestyle|}}};{{{titlestyle|}}};border:none;|mini=1}}<!-- | ||
--></div><!-- | |||
---Above--- | |||
-->{{#if:{{{above|}}}|<!-- | -->{{#if:{{{above|}}}|<!-- | ||
--> | --><div class="navbox-abovebelow mw-collapsible-content" style="margin: 0.2em; {{{basestyle|}}}; {{{abovestyle|}}};"><!-- | ||
-->{{{above}}}<!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
---Body (body simplified parameter) --- | |||
-->{{#if:{{{body|}}}|<!-- | |||
--><div class="mw-collapsible-content nowraplinks" style="margin: 0.2em; padding: 0 1em; {{{bodystyle|}}};"><!-- | |||
-->{{{body}}}<!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
---Body--- | ---Body (group1, list1, etc. paired parameters) --- | ||
-->{{#if:{{{group1|}}}|<!-- | |||
-->{{#if:{{{ | --><dl class="mw-collapsible-content nowraplinks" style="display: table; margin: -0.2em 0 0; width: 100%; border-spacing: 0.2222rem; text-align: left; {{{bodystyle|}}};"><!-- | ||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group1style|}}};"><!-- | |||
-->{{{group1}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}" style="display: table-cell; padding: {{{list1padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{oddstyle|}}}; {{{list1style|}}};"><!-- | |||
-->{{{list1}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->{{#if:{{{group2|}}}|<!-- | |||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group2style|}}};"><!-- | |||
-->{{{group2}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}" style="display: table-cell; padding: {{{list2padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{evenstyle|}}}; {{{list2style|}}};"><!-- | |||
-->{{{list2}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
-->{{#if:{{{ | -->{{#if:{{{group3|}}}|<!-- | ||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group3style|}}};"><!-- | |||
-->{{{group3}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}" style="display: table-cell; padding: {{{list3padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{oddstyle|}}}; {{{list3style|}}};"><!-- | |||
-->{{{list3}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
--></ | -->{{#if:{{{group4|}}}|<!-- | ||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group4style|}}};"><!-- | |||
-->{{{group4}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}" style="display: table-cell; padding: {{{list4padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{evenstyle|}}}; {{{list4style|}}};"><!-- | |||
-->{{{list4}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
-->{{#if:{{{group5|}}}|<!-- | |||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group5style|}}};"><!-- | |||
-->{{{group5}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}" style="display: table-cell; padding: {{{list5padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{oddstyle|}}}; {{{list5style|}}};"><!-- | |||
-->{{{list5}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
-->{{#if:{{{group6|}}}|<!-- | |||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group6style|}}};"><!-- | |||
-->{{{group6}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}" style="display: table-cell; padding: {{{list6padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{evenstyle|}}}; {{{list6style|}}};"><!-- | |||
-->{{{list6}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
--- | -->{{#if:{{{group7|}}}|<!-- | ||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group7style|}}};"><!-- | |||
-->{{{group7}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}" style="display: table-cell; padding: {{{list7padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{oddstyle|}}}; {{{list7style|}}};"><!-- | |||
-->{{{list7}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
-->{{#if:{{{ | -->{{#if:{{{group8|}}}|<!-- | ||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group8style|}}};"><!-- | |||
-->{{{group8}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}" style="display: table-cell; padding: {{{list8padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{evenstyle|}}}; {{{list8style|}}};"><!-- | |||
-->{{{list8}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
-->{{#if:{{{ | -->{{#if:{{{group9|}}}|<!-- | ||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group9style|}}};"><!-- | |||
-->{{{group9}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|even|{{{evenodd|odd}}}}}" style="display: table-cell; padding: {{{list9padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{oddstyle|}}}; {{{list9style|}}};"><!-- | |||
-->{{{list9}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
-->{{#if:{{{group10|}}}|<!-- | |||
--><div style="display: table-row;"><!-- | |||
--><dt class="navbox-group" style="display: table-cell; font-family: inherit; {{{basestyle|}}}; {{{groupstyle|}}}; {{{group10style|}}};"><!-- | |||
-->{{{group10}}}<!-- | |||
--></dt><!-- | |||
--><dd class="navbox-list navbox-{{#ifeq:{{{evenodd|}}}|swap|odd|{{{evenodd|even}}}}}" style="display: table-cell; padding: {{{list10padding|{{{listpadding|0em 0.25em}}}}}}; {{{liststyle|}}}; {{{evenstyle|}}}; {{{list10style|}}};"><!-- | |||
-->{{{list10}}}<!-- | |||
--></dd><!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
--></dl><!-- | |||
-->}}<!-- | |||
-- | ---Below--- | ||
-->{{#if:{{{below|}}}|<!-- | -->{{#if:{{{below|}}}|<!-- | ||
--> | --><div class="navbox-abovebelow mw-collapsible-content" style="margin: 0 0.2em 0.2em; {{{basestyle|}}}; {{{belowstyle|}}};"><!-- | ||
-->{{{below}}}<!-- | |||
--></div><!-- | |||
-->}}<!-- | |||
--></ | --></div><!-- | ||
--><noinclude> | --><noinclude> |
Latest revision as of 12:44, 3 January 2024
This template allows a navigational template to be set up relatively quickly by supplying it with navigational content, such as one or more lists of links. It comes equipped with default styles that should work for most navigational templates. Changing the default styles is not recommended, but is possible. Using this template is recommended to standardize navigational templates, and for ease of use.
Usage
Please remove the parameters that are left blank.
{{Navbox |name = {{subst:PAGENAME}} |title = |above = |body = |group1 = |list1 = |group2 = |list2 = ... |group10 = |list10 = |below = }}
Parameter list
The navbox uses lowercase parameter names, as shown in the box (at right). The mandatory name and title will create a one-line box if other parameters are omitted.
Notice "group1" (etc.) is optional, as are sections named "above/below".
The basic and most common parameters are as follows (see below for the full list):
name
- the name of the template.
title
- text in the title bar, such as: [[Widget stuff]].
body
- content to appear in the body section, a simplified alternative to group/list pairs (could be a list of overall wikilinks).
groupn
- the left-side text before list-n (if group-n omitted, list-n starts at left of box).
listn
- text listing wikilinks, often separated by middot templates, such as: [[A]]
{{·}}
[[B]]
Further details are explained below under section Parameter descriptions. See some alternate navbox formats under: Layout overview and Examples.
Parameter descriptions
The following is a complete list of parameters for using {{Navbox}}. In most cases, the only required parameters are name
, title
, and either body
or group1
.
Setup parameters
- name
- The name of the template, which is needed for the "v • d • e" ("view • discuss • edit") links to work properly on all pages where the template is used. You can enter
{{subst:PAGENAME}}
for this value as a shortcut. - state [
collapsed
] - Defaults to
uncollapsed
. A navbox withcollapsed
will start out collapsed. Otherwise, the navbox will be expanded. Often times, editors will want a default initial state for a navbox, which may be overridden in an article. Here is the trick to do this: In your intermediate template, create a parameter also named "state" as a pass-through like this: | state = {{{state<includeonly>|your_desired_initial_state</includeonly>}}}.
Content
- title
- Text that appears centered at the top of the navbox. It is usually the template's topic, i.e. a succinct description of the body contents. This should be a single line, but if a second line is needed, use
{{-}}
to ensure proper centering. - body
- If specified, text appears in the body of the navbox. Usually a list of links. A simplified alternative to group1, list1, etc. pairs.
- groupn
- (i.e. group1, group2, etc.) If specified, text appears on the left side of the body of the navbox.
- listn
- (i.e. list1, list2, etc.) If specified, text appears to the right of the corresponding groupn parameter. Usually a list of links.
- above
- Text displayed below the title and above the body.
- below
- Text displayed below the body (groups, lists and image).
Style parameters
Styles are generally not recommended as to maintain consistency among templates and pages in Wikipedia. However, the option to modify styles is given.
- style
- Specifies CSS styles to apply to the outer container.
- basestyle
- CSS styles to apply to the title, above, below, and group cells all at once. The styles are not applied to list cells. This is convenient for easily changing the basic color of the navbox without having to repeat the style specifications for the different parts of the navbox.
- titlestyle
- Styles to apply to title, such as the titlebar's background color.
- bodystyle
- Styles to apply to body, or to the container around group and list content.
- groupstyle
- CSS styles to apply to the groupN cells.
- groupnstyle
- CSS styles to apply to a specific group, in addition to any styles specified by the groupstyle parameter.
- liststyle
- CSS styles to apply to all lists. Overruled by the oddstyle and evenstyle parameters (if specified) below.
- listnstyle
- CSS styles to apply to a specific group, in addition to any styles specified by the liststyle parameter.
- listpadding
- A number and unit specifying the padding around each list. Default is padding of 0.25em on the left and right, and 0em on the top and bottom.
- oddstyle, evenstyle
- Applies to odd/even list numbers. Overrules styles defined by liststyle. The default behavior is to add striped colors (white and gray) to odd/even lists, respectively, in order to improve readability.
- evenodd
[swap, even, odd, off]
- If set to
swap
, then the automatic striping of even and odd rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the odd rows receive the gray striping instead of the even rows. Setting toeven
orodd
sets all rows to have that striping color. Setting tooff
disables automatic row striping. - abovestyle, belowstyle
- CSS styles to apply to the content specified via the above or below parameters.
Default styles
The style settings listed here are those that editors using the navbox change most often. The other more complex style settings were left out of this list to keep it simple. Most styles are set in MediaWiki:Common.css.
style = background:#fdfdfd; text-align: center;
titlestyle = background:#ccccff; padding-left:6em; padding-right:6em;
abovestyle = background:#ddddff; padding-left:1em; padding-right:1em;
belowstyle = background:#ddddff; padding-left:1em; padding-right:1em;
groupstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;
liststyle = text-align:left;
evenstyle = background:#f7f7f7;
Since liststyle and oddstyle are transparent odd lists have the color of the main style, which defaults to #fdfdfd (white with a hint of gray). A list has text-align:left;
if it has a group, if not it has text-align:center;
. Since only bodystyle has a vertical-align all the others inherit its vertical-align:middle;
.
Layout overview
Layout generated by {{Navbox}} with group and list pairs, and without above and below parameters (gray list background color added for illustration only):
Layout generated by {{Navbox}} with body, above, and below parameters (gray list background color added for illustration only):
Examples
{{Navbox |name = Navbox/doc |title = [[Archetypes]] |body = [[Blaster]]{{dot}} [[Brute]]{{dot}} [[Controller]]{{dot}} [[Corruptor]]{{dot}} [[Defender]]{{dot}} [[Dominator]]{{dot}} [[Mastermind]]{{dot}} [[Scrapper]]{{dot}} [[Sentinel]]{{dot}} [[Stalker]]{{dot}} [[Tanker]]{{dot}} [[Arachnos Soldier]]{{dot}} [[Arachnos Widow]]{{dot}} [[Peacebringer]]{{dot}} [[Warshade]] }}
{{navbox| | name = Navbox/doc | title = [[Issues|Issue Releases]] | group1 = [[Cryptic Studios]] | list1 = [[Issue 1]]{{dot}} [[Issue 2]]{{dot}} [[Issue 3]]{{dot}} [[Issue 4]]{{dot}} [[Issue 5]]{{dot}} [[Issue 6]]{{dot}} [[Issue 7]]{{dot}} [[Issue 8]]{{dot}} [[Issue 9]]{{dot}} [[Issue 10]] | group2 = [[Paragon Studios]] | list2 = [[Issue 11]]{{dot}} [[Issue 12]]{{dot}} [[Issue 13]]{{dot}} [[Issue 14]]{{dot}} [[Issue 15]]{{dot}} [[Issue 16]]{{dot}} [[Issue 17]]{{dot}} [[Issue 18]]{{dot}} [[Issue 19]]{{dot}} [[Strike Pack|Issue 19.5]]{{dot}} [[Issue 20]]{{dot}} [[Incarnates Ascend|Issue 20.5]]{{dot}} [[Issue 21]]{{dot}} [[Media Blitz|Issue 21.5]]{{dot}} [[Issue 22]]{{dot}} [[Issue 23]]{{dot}} [[Issue 24]]{{dot}} [[Issue 25 (Paragon Studios)]] | group3 = [[Homecoming Team]] | list3 = [[Issue 25]]{{dot}} [[Issue 26]]{{dot}} [[Issue 27]] }}
Technical details
- This template uses CSS classes for most of its looks, thus it is fully skinnable.
- For more technical details see the talk page, the CSS classes in MediaWiki:common.css, and collapsible elements in MediaWiki.