SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can you put a property name inside a </div> without a hassle?

    Even with indenting, keeping track of nested divs can drive you blind. I was thinking of putting the div id in the end div as a property name. Seems to me it should be legal, but will some browser (probably IE) choke on it? Since there isn't really a property I don't list it since that saves typing, and since it's a property name I don't have to type quotes. I imagine this would throw an error on XHTML, but I avoid that anyway.

    <div id='container'>
    blah blah
    <div id='inside'>
    more blah
    </div inside>
    </div container>

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,317
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    It's just asking for trouble, if nothing else. You could do this instead:

    Code:
    <div id='container'>
      <div id='inside'>
      </div><!-- end inside -->
    </div><!-- end container -->

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,251
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)
    I know the W3C specs aren't the easiest reading, but my take on
    Attributes for an element are expressed inside the elementís start tag.
    - that's start tag, not end tag.
    end tags consist of the following parts, in exactly the following order:
    A "<" character.
    A "/" character
    The elementís tag name.
    Optionally, one or more space characters.
    A ">" character.
    - nothing about having "extra" characters in it being OK.


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
  •