Template:Col head
{{{1}}}
This template uses TemplateStyles: |
Property | Internet Explorer |
Firefox | Safari | Chrome | Opera |
---|---|---|---|---|---|
column-width column-count |
≥ 10 (2012) |
≥ 1.5 (2005) |
≥ 3 (2007) |
≥ 1 (2008) |
≥ 11.1 (2011) |
columns | ≥ 10 (2012) |
≥ 9 (2011) |
≥ 3 (2007) |
≥ 1 (2008) |
≥ 11.1 (2011) |
break-before break-after break-inside |
≥ 10 (2012) |
≥ 65 (2019) |
≥ 10 (2016) |
≥ 65 (2016) |
≥ 15 (2013) |
This template is for creating headings that are designed to work well with CSS columns, such as those generated by {{div col}} and {{columns-list}}. Using this template prevents the heading from being placed at the very bottom of a column, which is usually undesirable.
With the optional force
parameter, you can also force a column break to occur immediately before this heading. This can be useful if you have two semi-related lists that you want to put in the same set of columns without allowing them to mi (for example, you might use it in a sports roster to separate the players from the staff).
Usage
lemba- Basic usage
{{col head|Your heading here}}
- All parameters
{{col head|Your heading here|type=|force=y|style=|class=}}
Parameters
lemba- 1st parameter
- The text content of your heading
|type=
- The type of heading to use. The value should be one of the following:
bold
(default): Creates a pseudo-heading with bold text- Wikitext equivalent:
'''Your heading here'''
- Aliases:
strong
,b
- Wikitext equivalent:
h1
,h2
, ...,h6
: Creates a section heading- Wikitext equivalent:
h4
→==== Your heading here ====
- Aliases:
1
,2
, ...6
- Wikitext equivalent:
term
: Creates adt
element, for use as a term in a- Warning: , this should not be used without a definition tag following it. Use the
bold
option instead. - Wikitext equivalent:
; Your heading here
- Aliases:
dt
- Warning: , this should not be used without a definition tag following it. Use the
none
: Creates adiv
element with unstyled text- Wikitext equivalent:
Your heading here
- Aliases:
div
,n
- Wikitext equivalent:
|force=y
- If set, it will try to force a column break to occur immediately before this heading. This means that the heading will appear at the start of the next column.
- Warning: A column break may not appear in some circumstances, such as if the viewport is too narrow. If you need a column break to occur even on very narrow screens, CSS columns are probably are not the right choice; try {{Col-begin}} instead.
|style=
- Additional CSS to be added to the heading element
|class=
- CSS class(es) to be added to the heading element
Known issues
lembaAs of June 2020,[update] there are no browsers with CSS support for break-after: avoid-column
, so this template uses a hacky workaround with break-inside: avoid-column
to emulate that behavior. This workaround results in two edge case bugs (though they're both unlikely to occur in normal use cases for this template).
Very short container
lembaIf the height of your columns container is less than 5em (equal to 70px at normal font size in the Vector theme), 5em=70px), the browser will think that your {{col head}} is taller than the container. Chrome handles this by simply making the container taller, which looks fine. Firefox, on the other hand, ends up placing subsequent elements in very weird positions on the page, which looks very bad.
In general, avoid using this template in very short columns boxes. It seems unlikely that you would need this template in such a scenario anyway; with so little content, you would likely be better off using fixed or float columns rather than CSS columns.
Tall next sibling
lembaIf a heading is immediately followed by an element that has a height of at least 5em and cannot have a break inside it (such as an element with break-inside: avoid-column
), it would likely cause the column breaks to be inserted in odd places (this has not been tested). This means this template may not play nicely with large unbreakable elements such as images, but most typically-formatted elements should be fine.
TemplateData
lembaTemplateData for Col head
This template is for creating headings that are designed to work well with CSS columns, such as those generated by {{div col}} and {{columns-list}}. Using this template prevents the heading from being placed at the very bottom of a column, which is usually undesirable.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Text | 1 | The text to be used for your heading | Content | required |
Type | type | The style of heading to use. Options: h1, h2, ..., h6, bold, term, none
| Line | optional |
Force column break? | force | If set to any value, a column break will occur immediately before this heading (meaning this heading will be placed at the top of the next column) | Boolean | optional |
Style | style | Additional CSS to apply to the heading tag
| String | optional |
Class | class | Additional CSS class(es) to add to the heading tag | String | optional |