Template:Flex columns
This template is used on many pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Lua error: Module:TNT:172: Missing JsonConfig extension, or not properly configured; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Lua banner.tab. See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates.
This template creates a two-column layout, where contents within the columns will have the same height, with any extra whitespace distributed throughout the shorter columns contents. It is mainly intended for use in portals.
This sort of layout requires browsers to support CSS flexbox. For those that don't there is a fallback that will show a two column view, but without the heights being the same (a layout many portals used as at July 2018).
For narrow screens, e.g. mobile devices, the display reverts to a single column.
Usage
{{Flex columns |1 = (...first column contents...) |2 = (...second column contents...) }}
Only contents which are in <div>...</div>
tags will have extra whitespace distributed to them – except for those with class flex-columns-noflex
(or otherwise override the flex:
property)
To change the column balance, |flex1=
and/or |flex2=
can be set. The default is 1
. For example:
|flex1=3 |flex2=2
will result in the first column taking up to 60% (3/5) of the available width, and the second column taking up at least 40% (2/5) of the width.
Note that the actual column balance will vary depending on screen size, since the minimum width of each column is set at 360px.
Example
{{Flex columns|{{lorem ipsum}}|{{lorem ipsum}}}}
See also
Column-generating template families
The templates listed here are not interchangeable. For example, using {{col-float}}
with {{col-end}}
instead of {{col-float-end}}
would leave a HTML "div" (division) open, potentially harming any subsequent formatting.
<section begin="table" />
Type | Family | Handles wiki
table code?File:Dagger-14-plain.png |
Responsive/ Mobile suited |
Start template | Column divider | End template |
---|---|---|---|---|---|---|
Float | "Col-float" | Yes | Yes | {{Col-float}}
|
{{Col-float-break}}
|
{{Col-float-end}}
|
"Columns-start" | Yes | Yes | {{Columns-start}}
|
{{Column}}
|
{{Columns-end}}
| |
Columns | "Div col" | Yes | Yes | {{Div col}}
|
– | {{Div col end}}
|
"Columns-list" | No | Yes | {{Columns-list}} (wraps div col)
|
– | – | |
Flexbox | "Flex columns" | No | Yes | {{Flex columns}}
|
– | – |
Table | "Col" | Yes | No | {{Col-begin}} , {{Col-begin-fixed}} or{{Col-begin-small}}
|
{{Col-break}} or{{Col-2}} .. {{Col-5}}
|
{{Col-end}}
|
File:Dagger-14-plain.png Can template handle the basic wiki markup {| | || |- |}
used to create tables? If not, special templates that produce these elements (such as {{(!}}
, {{!}}
, {{!!}}
, {{!-}}
, {{!)}}
)—or HTML tags (<table>...</table>
, <tr>...</tr>
, etc.)—need to be used instead.<section end="table" />