Results 1 to 7 of 7

Thread: XHTML and <hr> tag

  1. #1
    Join Date
    Jun 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default XHTML and <hr> tag

    hi
    i am trying to use the <hr> tag in a XHTML page...
    at first i used this
    Code:
    <hr color="blue">
    but when i tried to validate the code at w3.org, i got the error that
    Code:
    there is no attribute "color"
    so after some researching i found that i had to use the style attribute to give a color...so i did that...
    Code:
    <hr style="color:blue; size:2px;" />
    but now there is no color on the horizontal line and i am also not able to change the height of the horizontal line either using the size attribute or the style attribute..
    what am i doing wrong?
    any suggestions?
    thanks!

    EDIT: I just found out that it works in IE6 but not in FF..which came as a surprise to me...anyone know how to make it work in FF?
    Last edited by nihalz; 08-20-2007 at 05:22 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    i am trying to use the <hr> tag in a XHTML page...
    Don't -- stick with HTML 4.01 Strict. XHTML isn't yet supported by IE.
    so after some researching i found that i had to use the style attribute to give a color...so i did that...
    Try border-color, and don't style things inline -- use an external stylesheet.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    or possibly background-color

  4. #4
    Join Date
    Aug 2007
    Location
    Brazil
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think the best solution is actually applying borders to the hr, so you can customize it the way you want (colors, size, style, etc).
    Try applying borders and changing its background-color.

  5. #5
    Join Date
    Jun 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot guys
    i can give color to the line by using 'background-color'...though its still kinda weird why the color attribute doesn't work..
    tnx anywayz

  6. #6
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    the css color selector is used for text, not the background

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I believe the use of color and background-color for the hr tag differs by browser. Not sure on the details.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •