Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

gene c
gene c
13,630 Points

When do I use :after and when do I use ::after? I want to clear floats.

i want to clear floats.

When do I use a pseudo-class (:after) vs a pseudo-element (::after) selector?

1 Answer

Leandro Botella Penalva
Leandro Botella Penalva
17,618 Points

Hi Eugene,

There is no pseudo-class called after. After is always a pseudo-element. It used to be typed with one colon (:after) however in CSS3 uses the double colon syntax (::after) to differentiate pseudo-elements from pseudo-classes. Both will work but I like to stick with the double colon.