Help:Gallery tag
For the screen adaptive gallery template, see Template:Gallery.
For the Wikipedia image use policy for galleries, see Wikipedia:Image use policy#Image galleries.
As of version 1.4, MediaWiki supports making image galleries with the <gallery> tag.
Syntax
The basic syntax is:
<gallery> File:Wiki.png File:Wiki.png|Captioned File:Wiki.png|Captioned with alt text|alt=The Wikipedia logo File:Wiki.png|[[Help:Contents/Links|Links]] can be put in captions. File:Wiki.png|Full [[MediaWiki]] <br />[[syntax]] may now be used... </gallery>
Which produces:
-
Links can be put in captions.
The extended syntax is (see gallery tag help and hereafter for full list of parameters):
<gallery caption="Sample gallery" widths="180px" heights="120px" perrow="3"> File:Wiki.png File:Wiki.png|Captioned File:Wiki.png|Captioned with alt text|alt=The Wikipedia logo File:Wiki.png|[[Help:Contents/Links|Links]] can be put in captions. File:Wiki.png|Full [[MediaWiki]] <br />[[syntax]] may now be used... </gallery>
Which produces:
- Sample gallery
-
Links can be put in captions.
- Images are separated by new lines.
- Captions are optional.
- Notice that there are no brackets except for links within captions.
- A common mistake is to forget the closing
</gallery>tag. - The default width and height are 120px.
- If
perrow=is omitted, the width is fluid: one row comprises as many images as will fit across the available width. Prior to MediaWiki 1.17, the default was 4.
See also
| MediaWiki has documentation related to: Help:Images#Rendering a gallery of images |
- Wikipedia:Manual of Style/Images
- Wikipedia:Picture tutorial
- Wikipedia:Extended image syntax
- m:Template:gallery (backlinks, edit)
- More gallery options: see the drop-down box for more CSS gallery code
- mw:Help:Images#Rendering a gallery of images
