Cover Image for How to add a Line in Html
77 views

How to add a Line in Html

To add a horizontal line in HTML, you can use the <hr> (horizontal rule) tag. The <hr> tag creates a horizontal line across the width of the container or page. Here’s how you can use it:

HTML
<!DOCTYPE html>
<html>
  <head>
    <title>Horizontal Line Example</title>
  </head>
  <body>
    <h1>Welcome to My Webpage</h1>
    <p>This is some text.</p>
    <hr> <!-- Horizontal line -->
    <p>This is more text.</p>
  </body>
</html>

In the above example, the <hr> tag is placed between two paragraphs to create a horizontal line. The line will extend across the full width of its container.

You can further customize the appearance of the horizontal line using CSS or HTML attributes. For example, you can adjust the color, height, style, and position of the line using CSS properties.

HTML<span role="button" tabindex="0" data-code="
<hr color="red" size="2" style="border-style: dashed;">

In the above example, the line is customized to have a red color, a size of 2 pixels, and a dashed border style.

Remember to adjust the attributes or styles as per your requirements.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS