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

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.
 
J

Juan T. Llibre

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/
=========================
 
K

K Viltersten

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" />
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top