Structural Naming

Eric on structural class names again, but my question is whether or not semantics belong in class in the first place? No matter how you cut it, divs and spans are still the semantic duct tape of the web, and it seems like a better solution would be a richer array of semantic elements available in a way that’s backwards compatible with current HTML. (Not XHTML 2.0.)

3 replies on “Structural Naming”

  1. I can see what you’re saying there. But, until there’s a new and supported spec for those elements there’s really no better choice that I see than to use some semantics in class & ID values. That is, short of going full out XML, but that has its own problems across browsers when it comes to styling and so it’s not exactly a reasonable solution in most cases.

  2. Isn’t part of the reason for the move toward XML so that we can write our own tags, using whatever semantics make sense for our own situation. People seem to think this is the ideal.

    the logo
    the tagline

    But isn’t that really a very small jump from the code below?

    the tagline

    Couldn’t this be seen as writing our own semantic tags, just like XML, but easier? (no DTD). True, it would be nice if (X)HTML would have a richer array of semantic elements. But there will never be enough for every situation. The duct tape analogy is good though.

  3. Oops, I sure botched that. Sorry. (Didn’t realize my tags would be stripped.) Here are the two examples.

    XML:
    <branding>
    <logo>the logo</logo>
    <tagline>the tagline</tagline>
    </branding>

    HTML:
    <div id=”branding”>
    <div id=”logo”>the logo</div>
    <div id=”tagline”>the tagline</div>
    </div>

Comments are closed.