Template:Display box
This template is adapted from Template:Robelbox2. The main differences are summarized below.
Robelbox2 | Display box |
---|---|
predefined color themes | arbitrary colors |
border | no border |
optional icon | no icon |
The border (and other aspects) could be made customizable in the future, if desired. Also, icons could be added back in; they were removed for simplicity.
Notes
edit- This template was originally created for use on Eventmath, and the default colors reflect this.
- A more flexible template is Colored box, but it would need to be imported to Wikiversity. I didn't find the Colored box template in my initial search before creating this Display box template.--Greg at Higher Math Help (discuss • contribs) 08:24, 20 January 2022 (UTC)
Parameters
edit- title: Box title. Defaults to "Title" (without quotes).
- url: URL for link, which appears on the right side of the header. This parameter is optional.
- linkText: Link text for the link on the right side of the header. Defaults to value of url, if that is provided (does nothing if url not provided).
- content: Box content. Defaults to a non-breaking space, to prevent the empty content area from collapsing.
- width: Box width. Defaults to auto.
- titleBgColor: Title background color. Defaults to #006499.
- titleColor: Title text color. Defaults to white.
- linkColor: Link text color. Defaults to titleColor.
- contentBgColor: Content background color. Defaults to #f8f9fa.
- contentColor: Content text color. Defaults to black.
Examples
editMinimal example
editCode
edit{{Display box|title=Test title|content=Test content}}
Output
editTest title
Test content
Custom width
editCode
edit{{Display box|title=Test title|content=Test content|width=50%}}
Output
editTest title
Test content
Custom colors
editAny number of the custom color parameters can be set, from none at all, to all four of them.
Code
edit{{Display box|title=Test title|content=Test content|contentBgColor=black|contentColor=white}}
Output
editTest title
Test content
URL and link text
editCode
edit{{Display box|title=Test title|url=https://en.wikiversity.org/wiki/Eventmath|linkText=Eventmath|content=Test content}}
Output
editTest title
Test content
URL only
editCode
edit{{Display box|title=Test title|url=https://en.wikiversity.org/wiki/Eventmath|content=Test content}}
Output
editTest title
Test content
Custom link color
editCode
edit{{Display box|title=Test title|titleBgColor=#DAF3EF|titleColor=black| url=https://en.wikiversity.org/wiki/Eventmath|linkText=Eventmath|linkColor=#f8f9fa|content=Test content}}
Output
editTest title
Test content
Content with a list
editCode
edit{{Display box |title=Test title |content= * item 1 * item 2 }}
Output
editTest title
- Item 1
- Item 2