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 Accessibility Websites CSS: Part 2

Carl Sergile
Carl Sergile
16,570 Points

:focus

Hey so I noticed in the video that :focus should be applied to links, but should I go ahead and add a focus state to just regular text?

or what else can I use :focus on?

1 Answer

Daniel Gauthier
Daniel Gauthier
15,000 Points

Hey Carl,

The focus pseudo class can be applied to any element that can gain focus, so if the cursor stops on the element while cycling through the page with the tab key, you'll be able to use the class on it. A few examples are links and input elements like text inputs and radio buttons.

Since normal text doesn't generate this behavior, you'd have to find a way to have the text gain focus if you wanted to apply the focus effect. (Simply placing the cursor on the text with a mouse click won't work either)

Good luck with the course!