Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

How to use the hr element in HTML

Ayesha Naeem

The <hr> element in HTML adds a break or a line that represents a thematic break in the text. For example, the <hr> element can signify a change in topic.

Note: The <hr> element should not be used to represent different sections in a document. Different sections can be indicated by the <section> tag.

Syntax

Attributes and events

The following table describes multiple attributes of the <hr> tag:

Note: The following attributes are obsolete in HTML5 but can be used with style sheets.

Attribute Description
align This attribute accepts three values: left, right, and center, and aligns the break to the left margin, right margin, or to the center, respectively.
noshade This attribute accepts a boolean value and renders the break in a 3D fashion if it is not present; otherwise, it renders a plain line.
size This attribute accepts the number of pixels to specify the height of the break.
width This attribute accepts the number of pixels or a percentage to specify the width of the break.

The <hr> element supports global events and attributes.

Example

The following code demonstrates how to use the <hr> tag. The paragraph starting at line 7 explains Regression and the paragraph starting at line 15 explains Classification. The two topics are divided by a <hr> tag.

RELATED TAGS

html

CONTRIBUTOR

Ayesha Naeem
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring