Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Difference between pseudo class, pseudo selector, and pseudo element in CSS

Difference between pseudo class, pseudo selector, and pseudo element in CSS

Problem

Possible Duplicate:
What is the difference between a Pseudo-class and a pseudo-element in CSS?

What do the following mean in CSS?

  1. Pseudo class
  2. Pseudo selectors
  3. Pseudo element

What is the usefulness of each?

Problem courtesy of: Inquisitive

Solution

Pseudo-classes are used to select elements according to information that you can't otherwise express using attributes, IDs or classes (or any other info available through the DOM). For example, :root, :first-child, :last-child, :lang() and :not().

Pseudo-elements are mock elements that you can apply styles to selectively as part of other actual elements, but aren't themselves members of the DOM. For example, content fragments such as ::first-line and ::first-letter, or generated content such as ::before and ::after.

"Pseudo-selectors" is an umbrella term used to cover both kinds of selectors (or really any selector that begins with at least one :), but it is itself meaningless, because in Selectors, pseudo-classes and pseudo-elements are two fundamentally different things.

Solution courtesy of: BoltClock

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Difference between pseudo class, pseudo selector, and pseudo element in CSS

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×