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 CSS Foundations Selectors Link and User Action Pseudo-Classes

:focus Pseudo-Class only works with Input

Hello,

I tried to do exactly this video told me, which is

a:focus { background-color: yellow; }

but it doesn't work. The only thing that works is

input:focus { background-color: yellow; }

Also, I tried to make :focus available for everything, which is

:focus { background-color: yellow; }

It also doesn't work. Only works when I focus on the input.

Can anyone explain?

1 Answer

Hi - your code is correct. Take a look at my basic example: http://codepen.io/frogmcw/pen/eJcwn

Feel free to use my basic example and experiment. If you are still having difficult, post a codepen sample and we can take a closer look!

Hi Monica,

Thanks for your reply. I tried downloading the project files from the original video. Strangely, it doesn't work either. Maybe it has something to do with my browser? Currently using Safari 7.02