0
0
CSSmarkup~5 mins

Hover state in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the CSS <code>:hover</code> pseudo-class used for?
The <code>:hover</code> pseudo-class applies styles to an element when the mouse pointer is over it, creating interactive effects.
Click to reveal answer
beginner
How do you change the background color of a button when a user hovers over it?
Use CSS like button:hover { background-color: blue; } to change the button's background color on hover.
Click to reveal answer
intermediate
Can the :hover state be used on touch devices?
No, :hover works with mouse pointers and is not reliable on touch devices, which use taps instead.
Click to reveal answer
intermediate
Why should you use transitions with :hover effects?
Transitions make hover changes smooth and visually pleasing by animating the style changes over time.
Click to reveal answer
beginner
Write a CSS snippet to make a link text color change to red on hover with a smooth transition.
 a { color: black; transition: color 0.3s ease; } a:hover { color: red; } 
Click to reveal answer
What does the CSS selector button:hover target?
AAll buttons on the page
BA button when it is clicked
CA button when the mouse is over it
DA button when it is disabled
Which CSS property is commonly used with :hover to make changes smooth?
Aanimation
Btransform
Cdisplay
Dtransition
Can :hover styles be triggered on a smartphone by touching the screen?
ASometimes, depending on the device
BYes, always
CNo, never
DOnly if the device has a mouse
Which of these is a valid CSS rule to change text color on hover?
Ap:hover { color: green; }
Bp:click { color: green; }
Cp:hovered { color: green; }
Dp:hovering { color: green; }
What happens if you do not use transition with :hover?
AThe page reloads
BThe style changes instantly without animation
CThe element disappears
DThe hover effect will not work
Explain how the CSS :hover pseudo-class works and give an example of how to use it.
Think about what happens when you move your mouse over an element.
You got /3 concepts.
    Describe why adding a transition to hover effects improves user experience.
    Consider how sudden changes feel compared to smooth ones.
    You got /3 concepts.