SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: <hr> size

  1. #1
    SitePoint Evangelist anjanesh's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <hr> size

    <hr size="1"> is HTML 4.01 complaint but not xHTML 1.1.
    Since Im converting my pages to xHTML 1.1 I find that <hr style="border:1px solid black"> is a bit (slightly if you notice) thicker than size="1".

    Anyone know a workaround for this ?

    Thanks
    Anjanesh

  2. #2
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You are aware that style produces inconsistent results between browsers? <hr />'s are a pain to style.

    Now, <hr> should be <hr /> in XHTML, and you could stick those styles into an extrenal stylesheet:
    Code:
    <hr class="hr" />
    
    
    .hr {
    border: 1px solid black;
    }
    That's just as short.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mstwntd
    Now, <hr> should be <hr /> in XHTML
    <nitpicking>
    Actually it should be <hr/> in real XHTML. The space is only necessary when you're pretending to use XHTML while serving it as text/html, because some user agents have problems with this invalid HTML syntax.
    </nitpicking>
    Birnam wood is come to Dunsinane

  4. #4
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    <nitpicking>
    Actually it should be <hr/> in real XHTML. The space is only necessary when you're pretending to use XHTML while serving it as text/html, because some user agents have problems with this invalid HTML syntax.
    </nitpicking>
    Thanks.

  5. #5
    Non-Member
    Join Date
    Jan 2005
    Location
    Netherlands
    Posts
    4,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    There's a bit more code needed

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>12345 12345 12345 12345</title>
    <style type="text/css">
    .hr{
    background:#ff0000;/*NS FF OP*/
    color:#ff0000;/*IE ?*/
    border:none;/*FF NS OP*/
    height:1px;}/*FF NS OP*/
    </style>
    </head>
    <body>
    <hr />
    <p></p>
    <hr class="hr" />
    </body>
    </html>

  6. #6
    SitePoint Evangelist anjanesh's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah..height comes here and not border-width ? I tought height does not apply here !
    Thanks
    Anjanesh

  7. #7
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by anjanesh
    Ah..height comes here and not border-width ? I tought height does not apply here !
    It's because of the browser differences, as you can see in all4nerds' css comments.


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
  •