text-align: ***; margin-***: ***;

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The text-align property sets the text horizontal alignment, and the margin property sets the margins of an element.

For MSIE and Opera
The alignment of the horizontal rule can be specified by applying the text-align property to the HR element.

For Chrome, Safari, Firefox
The alignment of the horizontal rule can be specified by applying the margin property to the HR element.


hr {
width: 50%;
text-align: right;
margin-right: 0;
}

Property Value Explanation
text-align left aligns to the left IE O
right aligns to the right IE O
margin-left 0 aligns to the left Cr Sf Fx
margin-right 0 aligns to the right Cr Sf Fx

Example


<html>
<head>
<title>TAG index</title>

<style type="text/css">

hr {
width: 50%;
}

hr.left {
text-align: left;
margin-left: 0;
}

hr.right {
text-align: right;
margin-right: 0;
}

</style>

</head>
<body>

<hr>

<hr class="left">

<hr class="right">

</body>
</html>

Output