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

HTML How to Make a Website Customizing Colors and Fonts Use Classes in CSS

Anas Rida
Anas Rida
8,183 Points

pseudo-class for selected

why wasn't a pseudo-class for selected links created and instead a normal class for just one link? many thanks

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Because we don't really create pseudo classes. We just get to use them. Here are a list of available pseudo classes as documented by MDN https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes

Anas Rida
Anas Rida
8,183 Points

thank you for your reply. But then wouldn't we need to use the :active pseudo class for selected links for the example in the video, instead of creating a "selected" class for the top link only?

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

That would be amazing if we could do that. But alas, it only works during the button press or click. Between the mouse down and mouse up event the item becomes "active". So once you clicked on the link then released it... the link/page would no longer be active. Nice thought though! Here's some info on the active pseudo class.

https://developer.mozilla.org/en-US/docs/Web/CSS/:active