What is the CSS Hover Effects Generator?
Generate CSS hover effect code for buttons, cards, and links. Choose from lift, glow, underline, colour shift, and more - with live preview.
Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.
Using the CSS Hover Effects Generator
Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.
Select an effect type
Choose lift, glow, underline, fill, scale up, scale down, shine, or border highlight. The preview shows the effect on a sample element.
Adjust intensity and timing
Set the translation distance, shadow spread, or colour opacity. Adjust the transition duration and easing.
Copy the CSS
Click Copy to get both the base state and the :hover state rules together.
What the generated code looks like
Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.
/* Lift and shadow effect */
.card {
transition: transform 200ms ease, box-shadow 200ms ease;
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
/* Colour fill on link */
.nav-link {
position: relative;
color: #6C2EF5;
text-decoration: none;
}
.nav-link::after {
content: '';
position: absolute;
bottom: -2px; left: 0;
width: 0; height: 2px;
background: currentColor;
transition: width 250ms ease;
}
.nav-link:hover::after { width: 100%; }Use :focus-visible alongside :hover for keyboard accessibility. Hover effects should also apply on focus for users who navigate with keyboards.
Ready-to-use CSS patterns
Drop any of these straight into your project — no modifications needed.
Hover only where hover exists
Touch screens fire :hover on tap and can leave a card "stuck" lifted. Wrap the effect in a hover media query and mirror it on keyboard focus.
.card { transition: transform 200ms ease, box-shadow 200ms ease; }
@media (hover: hover) {
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgb(0 0 0 / .12); }
}
.card:focus-visible { outline: 2px solid #1B4DFF; outline-offset: 4px; }Image zoom inside a fixed frame
Scale the image, not the card, and clip the overflow so the layout around it never moves.
.thumb { overflow: hidden; border-radius: 16px; }
.thumb img { transition: transform 400ms ease; display: block; width: 100%; }
.thumb:hover img { transform: scale(1.06); }Common mistakes & how to fix them
A few habits trip people up. Here is what to watch for — and the exact fix.
Animating box-shadow on many cards
Transitioning a large box-shadow repaints on every frame and can stutter on long grids.
Fix: Put the larger shadow on a ::after pseudo-element and transition its opacity instead.
Using transition: all
transition: all also animates colour, width and layout properties you did not intend, and costs performance.
Fix: List the properties: transition: transform 200ms ease, box-shadow 200ms ease.
Hover-only affordances
Information that only appears on hover (an edit button, a caption) is unreachable on touch devices.
Fix: Show essential controls by default and use hover only to enhance them.
Pro tips for better results
Add :focus-visible for every hover effect
Keyboard users navigate with Tab and need focus styles as strong as hover styles. Apply the same visual treatment to :focus-visible that you apply to :hover.
translateY(-4px) is the standard card lift
A 2-4px upward movement on hover combined with a slightly larger box-shadow creates a convincing lift effect. More than 6px looks exaggerated.
Use currentColor for hover effects tied to the text colour
currentColor inherits from the element colour property. Using it in pseudo-element backgrounds or borders means the effect automatically adapts to different link colours.
Frequently asked questions
From the blog
Read more →CSS Animations: A Practical Guide to Keyframes and Transitions (2026)
Learn the difference between transitions and keyframe animations, how to write @keyframes, the properties worth animating for 60fps, and easing that actually looks good.
CSS clamp() and Fluid Typography: Stop Writing Font-Size Media Queries (2026)
Learn how CSS clamp() creates type that scales smoothly between screen sizes with a single line, the formula behind it, and how to build a fully fluid type scale without media queries.
The Complete Guide to CSS Gradients (2026)
Master linear, radial, and conic CSS gradients. Learn color stops, angles, hard stops for stripes, multi-layer gradients, and the tricks behind smooth, professional results.