Template:Text stroke2/doc

Revision as of 10:50, 25 May 2025 by Selfice (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template uses the CSS -webkit-text-stroke property to add stroke styles to text. This template has some usage restrictions, see #Limitations.

Parameters

Parameter Description Default Value
(1) The text to which the stroke is to be added, required None
Text color (2) Use CSS color values, such as: red / #114514 / rgb(191, 98, 10) / hsl(0deg, 100%, 50%).
See Help:Color list.
Inherited
Stroke color (3) Black
Stroke width Use CSS length values, such as: 1px / 0.2em, etc. (the actual stroke width is half of this value); or use the keywords thin, medium, thick for increasing thickness.
It is recommended to use "em" as the unit for consistent display across devices.
0.15em
CSS Additional CSS properties. None
CSS2 CSS properties applied only to the stroke layer, overriding the above CSS.
This parameter was mainly designed to address issues where "directly using the CSS parameter to add shadows results in double-layered shadows". Avoid adding shadows unless necessary, as the interaction between text-shadow and text-stroke is inconsistent across browsers and produces unpredictable effects in Safari.
None

Examples

Input Result
{{Text stroke2|Black text with black stroke, might as well use bold}} Black text with black stroke, might as well use boldBlack text with black stroke, might as well use bold
{{Text stroke2|Using anonymous parameters|#FFF|#FF9595}} Using anonymous parametersUsing anonymous parameters
{{Text stroke2|Using named parameters|Text color=white|Stroke width=0.1em}} Using named parametersUsing named parameters
{{Text stroke2|Using CSS|Text color=antiquewhite|Stroke color=brown|CSS=font-size:1.5em}} Using CSSUsing CSS

Limitations

  • Since this template duplicates the content of parameter 1 twice (one for the stroke layer and one for the text layer; otherwise, the effect would be like this, where the stroke would cover the text, with the text already set to white), it has the following restrictions:
    1. Do not use this template in {{Title replace}}. If used in {{Title replace}}, the title in the title bar will appear duplicated. For example, see Special:PermanentLink/5354170, where the title bar displays “-{群青讚歌群青讚歌}-”.
    2. Avoid placing this template in the outer layer of other templates. Instead, use {{lj|{{Text stroke2|…}}}} rather than {{Text stroke2|{{lj|…}}}}. This reduces the expansion length.
  • Shadows render abnormally in Safari, so avoid adding shadows where possible.

Related Templates

Template:Formatting template