Horje
HTML hr Tag

The <hr> tag in HTML represents a thematic break, typically displayed as a horizontal rule. The primary purpose of the <hr> tag is to create a visual separation between content sections within an HTML page.

Note: The <hr> tag also supports the Global Attributes and Event Attributes in HTML

Attributes

The table below shows a few attributes that allow customization:

Attribute ValuesValueDescription
alignleft center rightUsed to specify the alignment of the horizontal rule.
noshadenoshadeUsed to specify the bar without shading effect.
sizepixelsUsed to specify the height of the horizontal rule.
widthpixelsUsed to specify the width of the horizontal rule.

Example 1: In this example, we will see the implementation of the <hr> tag in HTML.

HTML
<!DOCTYPE html>

<html>

<body>
    <p>
        There is a horizontal rule 
          below this paragraph.
    </p>
    
  <!--HTML hr tag is used here-->
    <hr>
    <p>
        This is a horizontal rule 
          above this paragraph.
    </p>
</body>

</html>

Output: 

HTML-hr-Tag

Output

Example 2: In this example, we will see the implementation of the <hr> tag with some attribute in the HTML.

HTML
<!DOCTYPE html>

<html>

<body>

    <p>
        Normal horizontal line.
    </p>
    
      <!--HTML hr tag is used here-->

    <hr>
    <p>
        Horizontal line with height
          of 30 pixels
    </p>
    <hr size="30">

    <p>
        Horizontal line with height
          of 30 pixels and noshade.
    </p>

    <hr size="30" noshade>

</body>

</html>

Output:

HTML-hr-Tag-2

Output

Browser Support

  • Google Chrome: 1
  • Microsoft Edge: 12
  • Mozilla Firefox: 1
  • Opera: 12.1
  • Apple Safari: 3


Reffered: https://www.geeksforgeeks.org


HTML

Related
HTML5 &lt;footer&gt; Tag HTML5 &lt;footer&gt; Tag
HTML | &lt;frame&gt; Tag HTML | &lt;frame&gt; Tag
HTML &lt;legend&gt; Tag HTML &lt;legend&gt; Tag
HTML &lt;optgroup&gt; Tag HTML &lt;optgroup&gt; Tag
Difference between HTML and HTML5 Difference between HTML and HTML5

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
8