In HTML, the <hr>
tag stands for horizontal rule and it is used to create a thematic break or horizontal line between content.
- The
<hr>
tag supports the Global Attributes and Event Attributes in HTML. - The
<hr>
tag also support custom CSS styling. - The
<hr>
tag is an empty tag which means this tag does not need a close tag.
Syntax
<hr>
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML <hr> Tag</title>
</head>
<body>
<!-- Example 1 -->
<p>This is some content above the horizontal rule.</p>
<hr>
<p>This is some content below the horizontal rule.</p>
<!-- Example 2 with global attributes (Style) -->
<p>This is some content above the horizontal rule.</p>
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
<p>This is some content below the horizontal rule.</p>
</body>
</html>
Output