0
0
CSSmarkup

Active and focus states in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the <code>:focus</code> pseudo-class in CSS?
The <code>:focus</code> pseudo-class styles an element when it has keyboard focus, helping users see which element is active for keyboard navigation.
Click to reveal answer
beginner
How does the <code>:active</code> pseudo-class differ from <code>:focus</code>?
:active styles an element while it is being clicked or pressed, whereas :focus styles an element when it is selected or ready to receive input.
Click to reveal answer
beginner
Why is it important to style focus states for interactive elements?
Styling focus states improves accessibility by helping keyboard and assistive technology users know which element is currently selected or ready for interaction.
Click to reveal answer
beginner
Which CSS property is commonly used to create a visible focus outline?
The outline property is commonly used to create a visible border around an element when it receives focus.
Click to reveal answer
intermediate
Can you combine :focus and :active selectors in CSS? What does it do?
Yes, combining :focus and :active styles an element when it is both focused and being clicked, providing clear visual feedback during interaction.
Click to reveal answer
Which CSS pseudo-class applies when a user clicks and holds a button?
A:hover
B:focus
C:active
D:visited
What does the :focus pseudo-class help with?
AStyling elements when hovered by mouse
BStyling elements when disabled
CStyling elements after clicking
DStyling elements when keyboard focused
Which CSS property is best for showing a clear focus outline?
Aoutline
Bborder
Cbackground-color
Dtext-decoration
Why should you never remove focus outlines without replacement?
AIt makes keyboard navigation hard
BIt breaks page layout
CIt slows down page loading
DIt disables clicking
Which state is active when a user tabs to a link using the keyboard?
A:hover
B:focus
C:active
D:visited
Explain the difference between :focus and :active states in CSS and why both are important.
Think about keyboard navigation vs mouse clicking.
You got /4 concepts.
    Describe how you would style a button to show a clear focus state that is accessible and visible on all devices.
    Focus on visibility and accessibility.
    You got /4 concepts.