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 trialRishit Shah
4,975 PointsDifference between :focus and :target
What is the exact difference between :focus and :target pseudo classes. Can they be used in place of each other? Why?
1 Answer
James Anwyl
Full Stack JavaScript Techdegree Graduate 49,960 Points"The :focus pseudo class in CSS is used for styling an element that is currently targeted by the keyboard, or activated by the mouse." Source
"The :target pseudo selector in CSS matches when the hash in the URL and the id of an element are the same." Source
Also checkout this article for a good explanation of all the pseudo selectors.
Hope this helps :)