[Wsuug] New Web Page
young.zach at gmail.com
Thu Feb 18 09:08:36 EST 2010
On Thu, Feb 18, 2010 at 7:59 AM, Kelley Walker
<kcwalker at inkworkswell.com> wrote:
> that's a new one. where can i read up on the semanticness conveyed by class v id? i was unaware > that, by themselves, the class and id conveyed semantic meaning *as* class versus id.
> so how does naming something a class make is have meaning in a way that's
> different from an id? i get why the *name* of the class or id, matters, but
> not why class and id are different in terms of meaning. specificity, yes.
A lot of it may just be in my mind, but I'll try to explain. So take
everything that is said from here down as my opinion. This may be more
than you need, but I thought I'd be thorough. If you want a one line
answer, go to the bottom of the email.
For structure I don't know that it really is any better. That's just
I guess first I should clarify. I'm not saying that classes are not
semantic. There are plenty of places where it could be useful. For
example if you had a lot of lists of students, giving each a
class="students" would be the way to go.
However, there seems to be to be more value in saying things like:
etc. for unique elements on a page because it denotes that the element
is the only one of its kind on the page and the id tells it what it
is. In my mind, class="branding" doesn't have as much value because
first I would have to see class="branding" and then check the whole
page to see if there are anymore elements with a class of branding.
Rather than saying here is A branding (class=branding), using an id
says this is THE branding. To me its like using a definite article
rather than an indefinite one.
Examples of what I mean (using nonexistent HTML in the first example)
<aircraftcarrier id="cvn65" name="USS Enterprise" class="nimitz" />
This element is AN aircraftcarrier (tag)
This element has A class of nimitz (class)
The element is named THE USS Enterprise (name)
This element is THE csv65 (id)
***If you scrolled to the bottom of the email to skip my rambling,
start back here***
ids are definite articles (ids say "this is THE _____")
classes are indefinite articles (saying "this is A/AN _______")
More information about the Wsuug