SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    0 Post(s)
    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
    Melbourne, AU
    448 Post(s)
    8 Thread(s)
    It's just asking for trouble, if nothing else. You could do this instead:

    <div id='container'>
      <div id='inside'>
      </div><!-- end inside -->
    </div><!-- end container -->
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    West Springfield, Massachusetts
    187 Post(s)
    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.


Posting Permissions

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