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

General Discussion Pagination & Content Filter

Pagination Css .pagination li a.active background color change not working. Only works on hover not when clicked

I am currently working on my second project for Treehouse, pagination. I have everything working from search to dynamic pagination and selection, but the pagination li will not respond to the active css. design css-> .pagination li a.active does not seem to be working...it only works on the hover part. Any reason for this, I can't figure it out?

1 Answer

Not totally sure, but you may be confusing .active, the class, and :active, the pseudo-class. Try setting a CSS rule for .paginate li a:active and see if that's all it is. When a user clicks on something, the element is automatically given an :active pseudo-class for as long as the user clicks on it. When the user ends their click, the pseudo-class is automatically removed. An .active class would be something you needed to intentionally add to an element, either in your HTML or dynamically with JavaScript.

Thank you very much. I will try that.