The hr tag in HTML

The hr tag in HTML

The hr element is used for a thematic break between paragraph level elements. It usually appears as a horizontal line. A closing tag is not required.

<head>
  <title>The hr tag in HTML</title>
</head>
<body>
  <h2>The hr tag in HTML</h2>
  The hr element is used for thematic breaks between paragraph level elements.
  <p>Text above a line</p>
  <hr>
  <p>Text below the line</p>
  Usually displayed as a horizontal line.
</body>
where to use the hr tag

The hr element is a separator, not a border

It is very easy to misuse the hr element. If you find it included in a page template, you should rethink its use. The structural sections of your page design should be defined with appropriate semantic document tags. And any lines that need to be marked in the text should be highlighted using CSS. The hr tag, which creates a small separator bar, is best viewed as a typographic element that can go into the context of your content, rather than being used as part of the design. This can be useful for cases where you want to divide a piece of content into sections without using header elements.

Attributes applied to the hr tag

AttributesValues
colorspecifies the line color
widthsets the line width
sizeadjusts the line thickness
noshademakes the line without 3d effects
alignindicates line alignment

4 thoughts on “The hr tag in HTML”

Leave a Comment

Your email address will not be published. Required fields are marked *