Template:Navbox
Due to the sensitive nature of this template or the fact that it is used on a large number of pages, it has been semi-protected to prevent site-wide damage by vandal bots. Editors:In order to minimize the impact on our servers, please usesandboxesto make and test changes to widely used templates before deployment. For more information, please see this article'stalk page. |
Summary
This template allows a navigational template to be set up relatively quickly by supplying it with one or more lists of links. It comes equipped with default styles that should work for most navigational templates.
Parameters
Parameter | Scope | Description |
---|---|---|
Main | ||
name | optional | The name of the template (default: current template name). This controls the link targets forv • t • e links and should not be necessary in the vast majority of cases. To remove the links altogether, usenavbar=off . |
title | required | Text in the title bar |
state | optional |
|
navbar | optional | If set toplain ,theV • T • Elinks on the left side of the titlebar will not be displayed, and padding will be automatically used to keep the title centered. Useoff to remove theV • T • Elinks, but not apply padding (this is for advanced use only; the "plain" option should suffice for most applications where a navbar is not desired). It is highly recommended that one not hide the navbar, in order to make it easier for users to edit the template, and to keep a standard style across pages. |
border | optional | If set tochild orsubgroup ,then the navbox can be used as a borderless child that fits snugly in another navbox. |
Cells | ||
groupn | optional | (i.e.group1,group2,etc.) If specified, text appears in a header cell displayed to the left oflistn.If omitted,listnuses the full width of the table. |
listn | required | (i.e.list1,list2,etc.) The body of the template, usually a list of links. Use{{Navbox/Line}}in order to display the links. Currently supports up to 32 list/group pairs. |
image | optional | An image to be displayed in a cell below the title and to the right of the body (the groups/lists). For the image to display properly, thelist1parameter must be specified. |
imageleft | optional | An image to be displayed in a cell below the title and to the left of the body (lists). For the image to display properly, thelist1parameter must be specified and no groups can be specified. It accepts the same sort of parameter thatimageaccepts. |
above | optional | A full-width cell displayed between the titlebar and first group/list |
below | optional | A full-width cell displayedbelowthe template's body |
Style | ||
style | optional | SpecifiesCSSstyles to apply to the template body. The parameterbodystylealso does the exact same thing and can be used in place of thisstyleparameter. This option should be used sparingly as it can lead to visual inconsistencies. |
basestyle | optional | CSS styles to apply to thetitle,above,below,andgroupcells all at once. The styles are not applied tolistcells. |
titlestyle | optional | CSS styles to apply totitle,most often the titlebar's background color. |
groupstyle | optional | CSS styles to apply to thegroupncells. This option overrides any styles that are applied to the entire table. |
groupnstyle | optional | CSS styles to apply to a specific group, in addition to any styles specified by thegroupstyleparameter. |
groupwidth | optional | A number and unit specifying a uniform width for the group cells, in cases where little content in the list cells may cause group cells to be too wide. |
liststyle | optional | CSS styles to apply to all lists. Overruled by theoddstyleandevenstyleparameters (if specified) below. |
listnstyle | optional | CSS styles to apply to a specific list, in addition to any styles specified by theliststyleparameter. |
listpadding | optional | A number and unit specifying the padding in eachlistcell. Thelistcells come equipped with a default padding of 0.25em on the left and right, and 0em on the top and bottom. |
oddstyle evenstyle |
optional | Applies to odd/even list numbers. Overrules styles defined byliststyle.The default behavior is to add striped colors (white and gray) to odd/even rows, respectively, in order to improve readability. |
evenodd | optional | If set toswap ,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 |
optional | CSS styles to apply to the top cell (specified via theaboveparameter) and bottom cell (specified via thebelowparameter). Typically used to set background color or text alignment |
imagestyle imageleftstyle |
optional | CSS styles to apply to the cells where the image/imageleft sits. |
Defaults | ||
bodystyle | background:#fdfdfd; width:100%; vertical-align:middle; |
|
titlestyle | background:#ccccff; padding-left:1em; padding-right:1em; text-align:center; |
|
abovestyle | background:#ddddff; padding-left:1em; padding-right:1em; text-align:center; |
|
belowstyle | background:#ddddff; padding-left:1em; padding-right:1em; text-align:center; |
|
groupstyle | background:#ddddff; padding-left:1em; padding-right:1em; text-align:right; |
|
liststyle | background:transparent; text-align:left/center; |
|
oddstyle | background:transparent; |
|
evenstyle | background:#f7f7f7; |
|
Sinceliststyleandoddstyleare transparent, odd lists have the color of thebodystyle,which defaults to #fdfdfd (white with a hint of gray). A list defaults totext-align:left; if it has a group, if not it defaults totext-align:center; .Since onlybodystylehas a vertical-align all the others inherit itsvertical-align:middle; . |
||
Advanced | ||
aboveclass groupclass listclass belowclass |
optional | This enables attaching a CSS class to group or list cells. The most common use forlistclassis to give it thehlistclass that will cause lists to render horizontally. |
groupnclass | optional | This enables attaching a CSS Class to a specific group, if usedgroupclassshould be omitted as that will override this. |
titlegroup | optional | This puts a group in the title area, with the same default styles asgroupn. |
titlegroupstyle | optional | The styles for the titlegroup cell. |
innerstyle | optional | A very advanced parameter to be usedonlyfor advanced meta-templates employing the navbox. Internally, the navbox uses an outer table to draw the border, and then an inner table for everything else (title/above/groups/lists/below/images, etc.). Thestyle/bodystyleparameter sets the style for the outer table, which the inner table inherits, but in advanced cases (meta-templates) it may be necessary to directly set the style for the inner table. This parameter provides access to that inner table so styles can be applied. |
bodyclass | optional | This parameter is inserted into the "class" attribute for the navbox as a whole. |
titleclass | optional | This parameter is inserted into the "class" attribute for the navbox's title caption. |