Template:Icon text
Displays an icon with text.
Usage
The default size is x40px
meaning the icon is scaled until the height is 40 px. It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.
Icon Size
The width can be set via the w
parameter. This could be useful if several elements are supposed to align vertically for design purposes, such as in the "D&D 5th edition rules" table on the desktop Main Page. This also uses the block
and gap
parameters. See Template:MainPageDesktop for source.
Blocks
Setting block
to yes ensures that if the text part has to break into multiple lines, the second line doesn't flow under the icon and instead the text is constrained into a rectangular block. The gap
parameter can only be provided if block is set to yes, and determines the gap (in px) between the icon and the aforementioned rectangular text block.
Examples
Example | Markup | Renders as |
---|---|---|
Default | {{icon text | Flourish Icon.png | Flourish }} | |
With link | {{icon text | Flourish Icon.png | Custom Text | link = Flourish }} | |
Adjusting size & font size | {{icon text | size = 25 | font size = 80% | Flourish Icon.png | Flourish }} | |
With size, font size, and link | {{icon text | size = 25 | font size = 80% | Flourish Icon.png | Custom Text | link = Flourish }} | |
Missing icon | {{icon text | Missing Icon 123.png | Flourish | size = 30 }} |
No description.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Icon | 1 | File to use for the icon, without File: prefix.
| File | required |
Text | 2 | Text to show next to the icon.
| Content | required |
Link | link | Optional link, for both icon and text. | Page name | optional |
Width | w | Exact width of icon. | Number | optional |
Size | size | Preferred size of icon. | Number | optional |
Height | h | Maximum height of icon. | Number | optional |
Block | block | Whether to wrap the icon and text in a containing HTML element and use 'inline-flex' to align the icon and text. | String | optional |
Gap | gap | If 'block' is set, the exact gap to use between the icon and text. | Number | optional |
Nowrap | nowrap | Whether to use white-space: nowrap; to prevent line breaks. | String | optional |
Class | class | CSS class to add to the icon. | String | optional |
Separator | separator | What to put between the icon and text. Default is an NBSP. | Content | optional |
Font size | font size | Font size to use for text. | Number | optional |