HTML <hr> Tag Using Attributes

Horizontal line examples using only HTML attributes

📘 What is <hr>?

The <hr> tag creates a horizontal line used to separate content. Earlier HTML versions allowed styling using attributes like color, width, size, and align.

Note: These attributes are old (deprecated), but useful for learning basic HTML.

1️⃣ Change Line Color

<hr color="red">
<hr color="green">
<hr color="blue">



2️⃣ Change Line Width

<hr color="blue" width="25%">
<hr color="red" width="50%">
<hr color="orange" width="75%">



3️⃣ Change Line Thickness (Size)

<hr color="green" size="8">
<hr color="green" size="2">
<hr color="green" size="20">



4️⃣ Line Alignment

<hr color="purple" width="40%" align="left">

<hr color="orange" width="40%" align="center">

<hr color="black" width="40%" align="right">

Left aligned:


Center aligned:


Right aligned:


See uses of horizontal line in real websites