Template:Hr
![]() | This template is used on approximately 9,200 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. |
and whose height can be adjusted if desired. The rule appears on a line of its own, creating a line break if used mid-paragraph.
Usage
[edit]For the default appearance, insert {{hr}}
where you want the horizontal rule to appear. Text before {{hr}}
will appear above the rule, and text after it below.
To change the rule's height, use {{hr|height}}
, where height
is the thickness in pixels: for example {{hr|2}}
creates a rule two pixels high.
- The
height
value need not be a whole number. - To make the rule thicker (taller) than the default, use a value greater than 1.
- To make it thinner than the default, use a value between 0 and 1, exclusive.
- On lower-resolution displays:
- Small
height
differences might render the same. - A
height
less than 1 might render nothing (an "invisible line"). - For any given device, a visible line might become invisible, or vice versa, depending on what precedes it on the page. Thus, unrelated edits can affect the rendering.
- All of these effects were seen on a Windows laptop display, at 1366x768 resolution, in AD 2025. For these reasons, a
height
less than 1 is not recommended. See Examples and testing for the current renderings on your particular device.
- Small
- Enter just the number; don't add a unit such as
px
orem
after it. - Placing the template within a line of text,
like {{hr}} this
,
- will split the text at the rule,
- like
this
- like
Examples and testing
[edit]Rendering varies slightly depending on display resolution; see Usage.
Coding | Resulting line height on your display, today |
---|---|
{{hr|0.5}} |
|
{{hr|1}} or {{hr}} |
|
{{hr|1.5}} |
|
{{hr|2}} |
|
{{hr|2.5}} |
|
{{hr|3}} |
|
{{hr|4}} |
|
{{hr|5}} |
|
{{hr|10}} |
(At this point, we have a horizontal bar, not a horizontal rule. Some judicious restraint is recommended, making the line height proportional to [not equal to] that of the nearby text. {{hr|10}}
is excessive for most uses.)
Alternatives
[edit]A horizontal rule with the default appearance can also be produced by
- typing four hyphens
----
on a new line, or by - using an HTML
<hr />
tag.
The template inserts the HTML tag and gives it a style=
attribute if the height is specified. For example, {{hr|3}}
adds <hr style="height:3px" />
to the HTML for the page.
Parameters
[edit]The information in this section is used by VisualEditor and tools such as TemplateWizard.
TemplateData for Hr
Displays a horizontal rule (horizontal line).
Parameter | Description | Type | Status | |
---|---|---|---|---|
Height | 1 | The thickness of the rule, in pixels.
| Number | optional |