Use :hover to add visual feedback when a pointer is over a button, but keep the action available without hover. The examples below add color, lift, outline, and glow effects while preserving a visible keyboard-focus state and respecting reduced-motion preferences.
A safe starting point
Use a native <button> for an action. It already supports mouse, keyboard, touch, voice commands, and assistive technology; styling a decorative element to imitate a button does not provide those semantics. Set the button type deliberately: type="button" for an action that should not submit a form, or the appropriate submit/reset type when that is its job. See the MDN button reference.
<button class="button" type="button">Save changes</button>
.button {
border: 0;
border-radius: 0.4rem;
padding: 0.7rem 1rem;
color: white;
background: #3157c8;
transition: background-color 160ms ease, transform 160ms ease;
}
.button:hover {
background: #2444a8;
}
.button:focus-visible {
outline: 3px solid currentColor;
outline-offset: 3px;
}
.button:active {
transform: translateY(1px);
}
@media (prefers-reduced-motion: reduce) {
.button {
transition: none;
}
}
This is a starting point, not a guarantee that the colors contrast sufficiently in every design. Check the actual text/background contrast and ensure the focus outline is visible against the surrounding surface. Keep the hover rule an enhancement: the button’s label and operation must not depend on it.
Copyable hover effect variations
Append one of these rules to the base styles, or adapt its values. Keep a separate focus indicator even if the hover treatment is visually strong.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
Color change
.button:hover {
background: #2444a8;
}
A simple background or border change is usually the clearest treatment. Confirm that the label remains legible in both states.
Lift and press
.button {
transition: transform 160ms ease, box-shadow 160ms ease;
}
.button:hover {
transform: translateY(-2px);
box-shadow: 0 6px 14px rgb(0 0 0 / 18%);
}
.button:active {
transform: translateY(0);
box-shadow: 0 2px 5px rgb(0 0 0 / 18%);
}
The hover state suggests the control can be used; the active state gives feedback while it is being activated. Keep movement restrained and disable the transition for users requesting reduced motion, as in the base example.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Border or outline emphasis
.button {
border: 2px solid transparent;
transition: border-color 160ms ease;
}
.button:hover {
border-color: #b8c9ff;
}
.button:focus-visible {
outline: 3px solid #102c78;
outline-offset: 3px;
}
Do not make the keyboard focus treatment indistinguishable from the pointer-hover treatment. The W3C’s Technique C15 illustrates highlighting focus or hover as a way to communicate interactivity. It is an example technique, not a required coding recipe.
Glow without relying on movement
.button {
transition: box-shadow 160ms ease, background-color 160ms ease;
}
.button:hover {
background: #2444a8;
box-shadow: 0 0 0 4px rgb(49 87 200 / 25%);
}
.button:focus-visible {
outline: 3px solid #102c78;
outline-offset: 3px;
}
Use the glow as decoration alongside a legible state change, not as the only cue. Make sure it remains visible against the page background and does not obscure nearby content.
Recommended Free Tools
Rank #3
Make hover usable beyond a mouse
Keep the operation available on touch
:hover represents a pointer state. Touch devices do not necessarily have a sustained hover state, and browser behavior can vary. Do not reveal the only copy of the button label, an essential instruction, or the way to perform an action only on hover. MDN documents the touch caveat in its reference for :hover.
Show keyboard focus
Keep a visible focus indicator for people navigating by keyboard. :focus-visible lets the browser apply focus presentation according to its user-agent heuristics; do not remove the browser’s focus indicator unless you provide a visible replacement. The W3C notes that its techniques are examples of ways to meet WCAG, not the only valid implementation.
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Respect reduced-motion preferences
If a hover or focus treatment animates, use @media (prefers-reduced-motion: reduce) to remove or reduce that motion. The W3C provides a reduced-motion example that disables hover and focus motion for this preference.
Treat revealed content differently from decoration
A color change or shadow is ordinary visual feedback. If hover or focus exposes extra content—such as a tooltip or a menu—additional requirements apply: the content should be hoverable, dismissible, and persistent where applicable. Consult the W3C guidance on content on hover or focus and Technique SCR39. Do not use a fleeting hover animation as the sole way to access meaningful information.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Best Value
Links and state ordering
For links, state rules can override one another through the cascade. MDN documents the LVHA order: :link, :visited, :hover, then :active. Keep that order in mind when styling link states so later rules do not unexpectedly override earlier ones. Buttons are not links; use the appropriate element and selectors for the control’s job.
Check the effect before shipping
- With a keyboard, tab to the button and verify that focus is obvious; activate it with the keyboard.
- With a touch device, verify the action and its label are available without hovering.
- Check text contrast in default and hover states, and confirm the focus outline is distinguishable from both.
- Enable the operating system’s reduced-motion preference and confirm that hover and focus movement is removed or reduced.
- If the interaction reveals content, verify that it can be reached by pointer and keyboard, stays available long enough to use, and can be dismissed as applicable.
Or skip the browser setup
If you need screenshots to check how a page renders, ScreenshotNeo is a website screenshot API and MCP server. One GET request returns an image or PDF. For example, using the target page URL in place of the sample:
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for request options. It accepts cookie and consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




