Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: <hr /> Tag

  1. #1
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default <hr /> Tag

    I understand that one must not use a tag (in this example) <hr /> or <br /> with out defining it.

    I am still not clear as to how to define it or if it is defined in the css or htm?


    Thanks again,

    girard

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

    Default

    Tags are defined in the DTD (Document Type Definition) to which you point the parser with the <!DOCTYPE> tag at the beginning of your document. Both <hr> and <br> are defined in all doctypes since HTML 3.2 (except possibly frameset) and probably earlier.

    Don't insert XHTML syntax (such as self-closing tags, the <TAGNAME /> construct) into HTML pages. It may have unexpected effects. Also, it's generally a bad idea to serve XHTML to clients.
    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
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Girard Ibanez
    I understand that one must not use a tag (in this example) <hr /> or <br /> with out defining it.

    I am still not clear as to how to define it or if it is defined in the css or htm?


    Thanks again,

    girard
    What Twey says is correct but, if you are still wondering about it, just go ahead and use the tags. They are perfectly fine 'as is' with the exception that you should not use that self closing slash, use <br> and <hr>, not <br /> and <hr />.

    Once you start getting a bit more advanced in your coding you can, if you choose, define style for these or any other elements on your page. A DOCTYPE is always a very, very, good idea but, not absolutely required for the novice. From the designer's perspective, all a DOCTYPE does is tend to make the appearance of the page a little more consistent in the various browsers.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This is the doc type from DW8

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">

    So if I wanted to create a white space, will the <br /> tag be the correct syntax and still be validated by w3c?

    I know I am new to code but I have taken all your advice and rewrote my webpage. Great learning process and yes time consuming but well worth learning.

    I guess I am trying to understand two tags (br and hr) and proper usage using the above doc type declared.

    Thanks again

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

    Default

    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!

  6. #6
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Which of the two doctype that DW8 offers for new page should I use?


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


    girard

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

    Default

    The former.
    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!

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Strict is best if you can use it. It is no good for validation with iframes though, and there are probably some other things like that. However, this cannot be stressed enough:

    Don't use <br />

    Use <br>--------------------------!
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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

    Default

    Quote Originally Posted by John
    [Strict] is no good for validation with iframes
    And frames in general, in fact (the target attribute is also disallowed) for the simple reason that it's recommended not to use them
    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!

  10. #10
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Girard Ibanez
    So if I wanted to create a white space, will the <br /> ...
    On a different subject, that depends what exactly you're expecting the br element to do. It is for breaking lines, not inserting space between elements. For example:

    HTML Code:
    <div class="mailing-address">
        221B Baker Street<br>
        Westminster<br>
        London
    </div>
    is fine, but:

    HTML Code:
    <p>Some text</p><br><br>
    <p>Some more text</p>
    is not. In the latter case, CSS should be used to add more space using margins.

    Mike

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
  •