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

Discussion in 'ASP .Net' started by K Viltersten, Apr 9, 2009.

  1. K Viltersten

    K Viltersten Guest

    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.

    --
    Regards
    K Viltersten
    K Viltersten, Apr 9, 2009
    #1
    1. Advertising

  2. hi K,

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

    Basically, it's deprecated, otherwise:

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



    mfG
    --> stefan <--
    Stefan Hoffmann, Apr 9, 2009
    #2
    1. Advertising

  3. K Viltersten

    K Viltersten Guest

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

    >
    > Basically, it's deprecated, otherwise:
    > http://blakems.com/experimental/hr/


    Huh?! I didn't know that. Are you saying
    that <hr> is deprecated? Surely, you
    don't mean that left-alignment is...?

    And thanks for the answer, by the way!

    --
    Regards
    K Viltersten
    K Viltersten, Apr 9, 2009
    #3
  4. Stefan Hoffmann, Apr 9, 2009
    #4
  5. 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/
    =========================
    "Stefan Hoffmann" <> wrote in message news:%...
    > hi,
    >
    > K Viltersten wrote:
    >> Huh?! I didn't know that. Are you saying that <hr> is deprecated?

    > Yes:
    >
    > http://www.w3.org/TR/REC-html40/present/graphics.html#h-15.3
    >
    >
    > mfG
    > --> stefan <--
    Juan T. Llibre, Apr 9, 2009
    #5
  6. K Viltersten

    K Viltersten Guest

    >> Huh?! I didn't know that. Are you
    >> saying that <hr> is deprecated?

    >
    > Yes:
    > http://www.w3.org/TR/REC-html40/present/graphics.html#h-15.3


    I only see that the attributes are
    deprecated. Nothing about the element
    itself being deprecated. What do i miss?

    Also, if it's deprecated, what should
    one use now?

    Thanks!

    --
    Regards
    K Viltersten
    K Viltersten, Apr 9, 2009
    #6
  7. K Viltersten

    K Viltersten Guest

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

    --
    Regards
    K Viltersten
    K Viltersten, Apr 10, 2009
    #7
  8. K Viltersten

    bruce barker Guest

    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)


    K Viltersten wrote:
    > 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.
    >
    bruce barker, Apr 11, 2009
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kay
    Replies:
    2
    Views:
    7,149
  2. tshad

    text-align vs align

    tshad, Jun 23, 2005, in forum: HTML
    Replies:
    1
    Views:
    1,257
    David Dorward
    Jun 23, 2005
  3. Paul Lautman

    left align within centre align

    Paul Lautman, Mar 3, 2006, in forum: HTML
    Replies:
    3
    Views:
    574
    Paul Lautman
    Mar 3, 2006
  4. Steve Richter
    Replies:
    1
    Views:
    896
    Mark Rae
    Jun 24, 2007
  5. =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=

    Help on table align on left of page vs left hanging indent

    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=, Jul 10, 2007, in forum: XML
    Replies:
    2
    Views:
    1,001
    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=
    Jul 16, 2007
Loading...

Share This Page