Html Basic : Horizontal tag (hr) with example

 The <hr> tag can be styled using various attributes or CSS properties to control its appearance, such as its width, color, alignment, and more.


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HR Tag with Attributes Example</title>
</head>
<body>
<p>This is the first paragraph.</p>
<hr width="75%" size="3" color="blue" align="center">
<p>This is the second paragraph.</p>
</body>
</html>





Explanation:

  • width="75%": Sets the width of the horizontal line to 75% of the container's width.
  • size="3": Defines the height (thickness) of the line to 3 pixels.
  • color="blue": Sets the color of the line to blue.
  • align="center": Centers the horizontal line within its container.

These attributes are considered deprecated in HTML5, and using CSS for styling is recommended for modern web development.

Post a Comment

0 Comments