Open In App

HTML <hr> size Attribute

Last Updated : 03 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <hr> element’s size attribute defines the height (thickness) of the horizontal rule. It accepts numerical values that specify the pixel height. However, this attribute is deprecated in HTML5, and it’s recommended to use CSS for controlling the height of <hr> elements.​

Syntax

<hr size="pixels">

Attribute Values

It contains single value pixels which specify the height in terms of pixels.

Note: The <hr> size Attribute is not supported by HTML 5.

Example: In this example we centers a heading “GeeksforGeeks” and uses two <hr> elements, where the size attribute adjusts their thickness to 10 and 20 pixels, creating visually distinct horizontal lines.

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML hr size Attribute
    </title>
</head>

<body style="text-align:center;">
    <h1>GeeksforGeeks</h1>
    <hr width="500px;" size="10">
    <p>Computer science portal</p>
    <hr width="70%" size="20">
</body>

</html>

Output:

Supported Browsers

The browser supported by HTML <hr> size Attribute are listed below:



Next Article

Similar Reads