SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast newsomer's Avatar
    Join Date
    Oct 2001
    Location
    Southwestern Georgia, USA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ID in closing tag

    Strictly speaking (HTML 4.0, XHTML), is there any problem with inserting an ID parameter in a closing tag?

    Example:
    Code:
    <div id="mainContent">
     
    Lots
     
    of
     
    HTML
     
    </div id="mainContent">
    I know I could just as easy use a comment to identify the closing tag, e.g.:

    Code:
    <!-- begin mainContent -->
    div id="mainContent">
     
    Lots
     
    of
     
    HTML
     
    </div><!-- end mainContent -->
    But I would rather use the first example, no good reason, just seems simpler to me.

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    Nova Scotia, Canada
    Posts
    172
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could indent your DIV's and provide spacing if your not overly concerned with adding a few bits to your total page size:

    HTML Code:
    <div id="container">
    
         <div id="header">
              My Header Here
         </div>
    
         <div id="content">
              Content Here
         </div>
    
         <div id="footer">
              Footer Here
         </div>
    
    </div>


    -jamie[HTML]
    ----
    Cheers, Jamie

  3. #3
    SitePoint Enthusiast newsomer's Avatar
    Join Date
    Oct 2001
    Location
    Southwestern Georgia, USA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    True but if the div spans a few hundred lines and there are several long wrapping lines within it could still be somewhat unclear.

    Thank you for your reply but my real question is if the id parameter in the closing tag is allowable (correct, authorized, ethical, etc . . .).

  4. #4
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I recall reading somewhere on the W3C site that in order to have a properly formed XHTML document, you must include a properly formed (NO ATTRIBUTE) end tag along with every opening tag. The exception are the empty tags, which are covered by a special case.

    So to answer your question, putting an ID in the closing tag will work, but it is not correct, authorized by the standards, or ... ahem, ethical. I doubt it would pass the validator checks either, if that is a concern for you.

  5. #5
    Employed Again Viflux's Avatar
    Join Date
    May 2003
    Location
    London, On.
    Posts
    1,127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ran a quick test on the validator and...

    Quote Originally Posted by W3C
    Line 10, column 8: name start character invalid: only S separators and TAGC allowed here

    </div id="empty">




    Line 10, column 9: character data is not allowed here

    </div id="empty">

  6. #6
    SitePoint Enthusiast newsomer's Avatar
    Join Date
    Oct 2001
    Location
    Southwestern Georgia, USA
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Shows I don't run my validator.

    That really answers the question, thanks!
    There are three types of people.
    Those that can count and
    those that cannot.


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
  •