tags:

views:

54

answers:

3

This is a bit of a pedantic question, but perhaps worth asking. Is there, mechanically, a difference between a pseudo-class and a pseudo-selector in CSS? We use the term interchangeably around here, but it seems that there's a reason for the two terms. Is there any use to differentiating the two?

Thanks, Joe

+2  A: 

a pseudo-class is the actual psuedo element, such as :hover, :active, etc..

a pseudo-selector is the complete selector that contains/uses a pseudo-class. such as a:hover, a:active

but pseudo-class is what people should be saying/typing. pseudo-selector I think came from people knowing there was 'pseudo' and 'selectors' so 'why the hell not put them together?' kind of thing.

Dan Heberden
I'm not sure about this pseudo-selector concept... do you have any references? Because right now I'm more in favor of @david dorward's answer
marcgg
I have references for pseudo-class because it's defined as the "active" or "hover". the term selector is just that, the selector. If I have `input[name=username]` - that is a _selector_ . No references, just common sense and logic :)
Dan Heberden
+4  A: 

A pseudo-class is a specified thing, while psudo-selector is a made up word.

(Meanwhile, a pseudo-class matches an element when certain conditions are met (e.g. the mouse is pointing at it, or it is the first child of its parent), while a pseudo-element is something that can be matched but isn't a real or whole element (such as "Thing before an element" or "First line of text in an element")

David Dorward
+3  A: 

pseudo-selector does make the odd appearance on the W3C site, but my initial search suggests that it is an old old term that has now been replaced with pseudo-class:

pseudo-selector

the page pseudo-selector :first

http://www.w3.org/TR/2004/CR-css-print-20040225/#section-selectors

CSS has a "lang" pseudo-selector that automatically uses the appropriate attribute depending on the media type

http://www.w3.org/TR/xhtml-media-types/

pseudo-class

5.11.4 The language pseudo-class: :lang

http://www.w3.org/TR/CSS2/selector.html#lang

...and many more.

Pseudo-elements and pseudo-classes

Then there's the descriptions for pseudo-elements and pseudo-classes:

http://www.w3.org/TR/CSS2/selector.html#pseudo-elements

So it looks to me as though pseudo-selectors are no longer in vogue...

Mike
I suppose *pseudo-selector* is a handy generic term for a selector which selects for *pseudo-classes* and *pseudo-elements*. Just a thought (and a thought that is similar to Dan Heberden's comment about his own answer).
Mike