Template:Col head/doc

From CWS Planet
< Template:Col head
Revision as of 15:28, 14 July 2022 by Alynnidalar (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Lua error in Module:TNT at line 160: attempt to index field 'data' (a nil value).

CSS3 multiple-column layout browser support
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

Basic usage
{{col head|Your heading here}}
All parameters
{{col head|Your heading here|type=|force=y|style=|class=}}

Parameters

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
  • h1, h2, ..., h6: Creates a section heading
    • Wikitext equivalent: h4==== Your heading here ====
    • Aliases: 1, 2, ... 6
  • term: Creates a dt element, for use as a term in a glossary
    • Warning: For accessibility reasons, this should not be used without a definition tag following it. Use the bold option instead.
    • Wikitext equivalent: ; Your heading here
    • Aliases: dt
  • none: Creates a div element with unstyled text
    • Wikitext equivalent: Your heading here
    • Aliases: div, n
|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

As of June 2020, 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

If 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

If 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

This is the TemplateData documentation for this template used by VisualEditor and other tools.

TemplateData 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.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Text1

The text to be used for your heading

Contentrequired
Typetype

The style of heading to use. Options: h1, h2, ..., h6, bold, term, none

Default
bold
Lineoptional
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)

Booleanoptional
Stylestyle

Additional CSS to apply to the heading tag

Example
color:blue; text-align:center;
Stringoptional
Classclass

Additional CSS class(es) to add to the heading tag

Stringoptional