Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Difference between active and focus
Can some one explain to me the difference between active and focus with examples
Thank you in Advance
Kevin D8,621 Points
Focus seems to relate more with
input elements. You may want to target a user who is typing into a particular field of your form. The best way would be to wait for the user be 'in focus' of this particular input field (by default, browsers add a border highlight around an input field when you are in focus).
Active seems to correspond more with a mouse-click interaction with a button or link. If the user clicks on a button, you would target this action with the
Clayton PerszykTreehouse Moderator 48,107 Points
:focus represents the state when the element is currently selected to receive input and :active represents the state when the element is currently being activated by the user.