How to align the <hr> element to the left?

  • Thread starter Thread starter K Viltersten
  • Start date Start date
K

K Viltersten

I've used the following.

<hr style="width: 50%; text-align: left" />

While the width works just fine, the
alignment does not. How can i force the
horizontal separator to be left-aligned?

Why doesn't the above work? It only
places the (shortened to half of the
screen's length) element in the middle.
 
re:
!> Are you saying that <hr> is deprecated?
!> Yes:

While that is undoubtedly true, deprecated features remain in the current version,
although their use may raise warning messages recommending alternate practices
and deprecation may indicate that the feature will be removed in the future.

I.o.w., a deprecated feature still works although programmers should strive to
eventually use alternate programming to be ready for when the feature is removed.

In this case, HR is not deprecated.

What is deprecated is the method by which alignment is obtained,
among other attributes which have been deprecated for the HR tag.

Now, the preferred method to modify a horizontal rule's attribues is with style sheets/CSS.

http://blakems.com/experimental/hr/

offers excellent examples of usage of styles for the horizontal rule.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
=========================
 
In this case, HR is not deprecated.
What is deprecated is the method by which
alignment is obtained, among other
attributes which have been deprecated for
the HR tag.

Now, the preferred method to modify a
horizontal rule's attribues is with style
sheets/CSS.

Hmm... I used the following but didn't get
any difference in the horizontal alignment.
The width changes, though. Any thoughts?

<hr style="width: 50%; text-align: left" />
 
hr is a block element, and text-align has no effect on block elements in
css compliant browsers .you should set the

<hr style="margin-left:0px" />

the problem is older versions of ie are not css compliant, but use
text-align, so you need to set both:

<hr style="margin-left:0px;text-align:left" />

-- bruce (sqlwork.com)
 
Back
Top