Waleed Eissa
Waleed Eissa

Reputation: 10513

Selecting an element that has a specific class and ID

I tried this and it worked in all browsers (IE, FF, Chrome, Opera and Safari):

.classname#id

Still, I can't find this mentioned anywhere on w3c.org, can you point me to where this is mentioned? I mean if this is supported by all those browsers then it must be part of the standard, isn't it?

Many thanks

Upvotes: 3

Views: 998

Answers (2)

mbillard
mbillard

Reputation: 38832

It is useless though, only specifying the ID would be enough.

#id

...unless you tried to be clever and used an identifier for more than one element.

Upvotes: 1

zooglash
zooglash

Reputation: 1775

You can chain CSS selectors, it's just like using H1.title where you chain a type selector (H1) and a class selector (.title). See http://www.w3.org/TR/css3-selectors/#selector-syntax

Upvotes: 4

Related Questions