Template:Gallery/doc

Template page

This template provides advanced gallery building functionality (fine-tuned formatting control).

This template displays a gallery of images in an array, left-to-right in rows. Global parameters |width= and |height= control the size of all images in the gallery. The number of images per row is based upon the image width parameters and the width of the screen. The number of images per row can change when the user resizes the window.

{{Gallery
| title        = 
| align        =
| footer       =
| style        =
| class        =
| state        =
| height       =
| width        =
| captionstyle =
| File:
 | alt1=
 | Write a caption here
| File:
 | alt2=
 | Write a caption here
| File:
 | alt3=
 | Write a caption here
| File:
 | alt4=
 | Write a caption here
| File:
 | alt5=
 | Write a caption here
}}

Parameters

For each image

Specify a line of the following form for each image.

|File:Filename |altn=Alt text |Caption

Where:

|File:Filename – the image's file name. Either File: or Image: prefix may be used
|Altn= – alt attribute: |alt1= for the first image, |alt2= for the second image, etc
Alt text – the alternative text for the image, used by visually impaired or other readers who cannot see the image clearly. If omitted, the image's alt text will be blank.
|Caption – the caption under the image

Optional parameters

These parameters apply to the gallery:

|title= – The gallery's title
|align= – The alignment of the gallery on the page, left (default), center, or right; ignored when |state= is set
|footer= – Small, right-aligned text below the images
|style=CSS style directives for the whole gallery (see Wikipedia:Help:Cascading Style Sheets)
|class= – HTML class for the whole gallery
|state= – Sets the default state of collapsible galleries; use |state=expanded or |state=collapsed; collapsible galleries occupy the full page width
|mode= – Sets the mode used by the inner gallery tag. Common values include |mode=packed and |mode=nolines (see Wikipedia:Help:Gallery tag for more options)

These parameters apply to all of the images in the gallery:

|noborder= – Cancel the border surrounding the images, use |noborder=yes to set.
|whitebg= – Cancel the white background surrounding the images, use |whitebg=no to set.
|height= – Maximum height of each image. If this parameter is not included, defaulting to 180 pixels.
|width= – Maximum width of each image, defaulting to 180 pixels.
|captionstyle=CSS style directives for the captions (see Wikipedia:Help:Cascading Style Sheets)
|showfilename= – Allow to show the file name of each image, use |showfilename=yes to set.

The image's original ratio of width to height cannot be modified by |width= or |height= – a rectangular image will not be made square if |width= and |height= are set to the same value.

Example

Sourcecode of example

{{Gallery
|caption=Photographs
|width=150
|perrow=4
|Image:Oost_amsterdam_cs.JPG|Oostzijde Centraal Station
|Image:AMS_central_station_3.jpg|[[Stationsplein (Amsterdam)|Stationsplein]] Amsterdam
|Image:Asd_cs_afstand.JPG|Het station vanaf de [[Oude Kerkstoren]]
<!-- ... -->
}}

The source and idea for this template come from w:Template:Gallery.