HTML Horizontal Rule

 HTML Horizontal Rule

HTML Horizontal Rule renders a line in a web browser. It is an empty element.

The <hr /> element defines an HTML Horizontal Rule.

Look at the example below, to see how it works.

Example:

<!doctype html>
<html>
    <head>
        <title> Horizontal Rule </title>
    </head>
    <body>
        <p>This is an HTML Paragraphs.</p>
        <hr />
        <p>This is an HTML Paragraphs.</p>
    </body>
</html>

Output:

Styling and Changing the Color of HTML Horizontal Rules

In the example below you will learn how to style HTML Horizontal Rule by changing its width and height.

To change its color we need to use the color attribute.

Example:

<!doctype html>
<html>
    <head>
        <title> Using CSS Horizontal Rule </title>
    </head>
    <body>
        <hr style="width: 50%" color="black" />
        <hr style="height: 40px" color="black"/>
        <hr color="gold"/>
    </body>
</html>

Output:

✔️ You can style your own HTML Horizontal Rules depending on your needs.


    
                                                                                

Post a Comment

Post a Comment (0)