Template:Sprite: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<includeonly><span style="position: relative; height: {{{size|16}}}px; width: {{{size|16}}}px; overflow: hidden; display: inline-block; vertical-align: {{{align|middle}}};"><s...") |
m (Corrected link to a doc template) |
||
Line 1: | Line 1: | ||
<includeonly><span style="position: relative; height: {{{size|16}}}px; width: {{{size|16}}}px; overflow: hidden; display: inline-block; vertical-align: {{{align|middle}}};"><span style="position: absolute; height: {{{sheetsize|256}}}px; width: {{{sheetsize|256}}}px; {{Sprite/pos|{{{pos|1}}}|{{{size|16}}}|{{{sheetsize|256}}}}}">[[File:{{{image|BlockCSS.png}}}|link={{{link|}}}]]</span></span></includeonly><noinclude> | <includeonly><span style="position: relative; height: {{{size|16}}}px; width: {{{size|16}}}px; overflow: hidden; display: inline-block; vertical-align: {{{align|middle}}};"><span style="position: absolute; height: {{{sheetsize|256}}}px; width: {{{sheetsize|256}}}px; {{Sprite/pos|{{{pos|1}}}|{{{size|16}}}|{{{sheetsize|256}}}}}">[[File:{{{image|BlockCSS.png}}}|link={{{link|}}}]]</span></span></includeonly><noinclude> | ||
{{/doc}} | {{Sprite/doc}} |
Latest revision as of 10:06, 4 March 2015
{{#vardefine: nodoc | {{{nodoc}}} }}{{#vardefine: baddoc | {{{baddoc}}} }}
This template creates a sprite from a sheet image. Commonly used when many small images are displayed on one page to reduce the total amount of HTTP connections.
Examples
{{Sprite |pos=1 |align=text-top |image=BlockCSS.png |link=Grass |size=16 |sheetsize=256 }}
gives:
Parameter | Function | Default value |
---|---|---|
pos |
Position index of the sprite, depends on size and sheetsize (left to right, starting at top-left sprite) |
1 |
align |
Sets the vertical alignment of the image to the text. | middle |
image |
Sprite sheet image, without prefix | BlockCSS.png |
link |
Create a link to this page | None |
size |
Size of each sprite in pixels, width and height | 16 |
sheetsize |
Size of the whole sheet in pixels, width and height, must be multiple of size |
256 |