Jump to content

Template:Gallery/doc

From Wikibooks, open books for an open world

This template shows a set of images in an array. The number of images per row is based upon the width specified and the width of the screen, which allows greater flexibility than the <gallery>...</gallery> tag.

Parameters

[edit source]

For each image

[edit source]

Specify a line of the following form for each image.

|File:Filename|altN=Alt text|Caption
  • Filename is the image's file name. It can use a File: instead of an Image: prefix.
  • N should be 1 for the first image, 2 for the second image, and so forth.
  • Alt text is the alt text for the image, used by visually impaired and other readers who cannot see the image. If omitted, the image's alt text is blank.
  • Caption is the caption.

If no such lines are present, a gallery with a single question-mark image is produced. There is currently a limit of 100 such lines.

[edit source]

These parameters are optional.

title
The gallery's title.
width
(default 180) Maximum width of each image.
height
(default 180) Maximum height of each image.
perrow
The number of gallery boxes specified to occupy in single line.
noborder
(default no) Used to cancel the grey border surrounding the image.
whitebg
(default yes) Switch the background color between white and grey surrounding the image.
mode
(default traditional) Sets the mode used by the inner gallery tag. Available values including traditional, nolines, packed, slideshow.

Example

[edit source]
{{#switch:{{{2}}}|nowiki|nw={{#tag:nowiki|{{{3}}}}}|{{{2}}}}}|white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;{{{style|}}}">{{#switch:{{{1}}}|nowiki|nw={{#tag:nowiki|{{{2}}}}}|{{{1}}}}} }}