SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/hover-effects

7 CSS Hover Effects

7 Pure CSSPublished 2026-10-05Free · no sign-up

Seven hover effects for everyday interface parts: a card that lifts, a tile whose shape morphs, a list row with a sliding background, a nav that dims everything except the hovered link, row actions that appear, a settings gear that turns and category tiles that invert their colours.

01. Lift with Growing Shadow

HoverShadow

The basic interface hover: the element rises 4px and its shadow grows softer and wider, as if it moved toward you. Two shadows, a tight one and a blurred one, change together, which looks more natural than one large shadow.

View code
<a class="hv1" href="#docs"><b>Documentation</b><span>Guides, API reference and examples.</span></a>
.hv1 { display: grid; gap: 4px; width: 260px; max-width: 100%; box-sizing: border-box; padding: 18px; border: 1px solid #e4e7ec; border-radius: 14px; background: #fff; color: #475467; font: 14px Inter, system-ui, sans-serif; text-decoration: none; box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.1); transition: transform .25s ease, box-shadow .25s ease; }
.hv1 b { color: #101828; font-size: 16px; }
.hv1:hover, .hv1:focus-visible { transform: translateY(-4px); box-shadow: 0 4px 6px -2px rgba(16,24,40,.05), 0 16px 24px -6px rgba(16,24,40,.16); }
.hv1:focus-visible { outline: 3px solid #84adff; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hv1 { transition: box-shadow .25s; } .hv1:hover, .hv1:focus-visible { transform: none; } }

02. Shape Morph on Hover

HoverShape

An icon tile morphs from a squircle to a soft blob shape on hover by transitioning an eight-value border-radius. Each corner gets its own horizontal and vertical radius, which is how CSS makes organic shapes without SVG.

View code
<a class="hv2" href="#ideas" aria-label="Ideas"><span aria-hidden="true">💡</span></a>
.hv2 { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 28% 28% 28% 28% / 28% 28% 28% 28%; background: linear-gradient(135deg, #f59e0b, #db2777); font-size: 40px; text-decoration: none; transition: border-radius .6s cubic-bezier(.2,.8,.2,1), transform .6s; }
.hv2:hover, .hv2:focus-visible { border-radius: 62% 38% 46% 54% / 44% 60% 40% 56%; transform: rotate(8deg); }
.hv2:focus-visible { outline: 3px solid #fcd34d; outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .hv2 { transition: none; } .hv2:hover, .hv2:focus-visible { transform: none; } }

03. List Row with Sliding Background

HoverList

Hovering a list row slides a tinted background in from the left and nudges the text right, a clear hover for menus and file lists. The background is a gradient whose size goes from 0 to 100 percent, so there is no extra element.

View code
<ul class="hv3"><li><a href="#f1">Invoice-2041.pdf</a></li><li><a href="#f2">Brand-guide.pdf</a></li><li><a href="#f3">Q3-report.xlsx</a></li></ul>
.hv3 { box-sizing: border-box; width: 260px; max-width: 100%; margin: 0; padding: 6px; list-style: none; border: 1px solid #e4e7ec; border-radius: 12px; background: #fff; font: 600 14px Inter, system-ui, sans-serif; }
.hv3 a { display: block; padding: 11px 12px; border-radius: 8px; color: #344054; text-decoration: none; background: linear-gradient(#eef4ff, #eef4ff) no-repeat 0 0 / 0% 100%; transition: background-size .3s ease, padding .3s ease, color .3s; }
.hv3 a:hover, .hv3 a:focus-visible { background-size: 100% 100%; padding-left: 18px; color: #1d4ed8; }
.hv3 a:focus-visible { outline: 2px solid #528bff; outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .hv3 a { transition: color .3s; } }

04. Dim the Others

Hover:has()

When one item in a nav or list is hovered, the rest fade back, which points attention at the hovered one. :has(a:hover) on the list lets CSS style every link that is not hovered, with no script.

View code
<nav class="hv4" aria-label="Footer"><a href="#about">About</a><a href="#careers">Careers</a><a href="#press">Press</a><a href="#contact">Contact</a></nav>
.hv4 { display: flex; flex-wrap: wrap; gap: 4px 18px; font: 800 22px Inter, system-ui, sans-serif; }
.hv4 a { color: #f8fafc; text-decoration: none; transition: opacity .25s; }
.hv4:has(a:hover) a:not(:hover), .hv4:has(a:focus-visible) a:not(:focus-visible) { opacity: .35; }
.hv4 a:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; border-radius: 3px; }

05. Row Actions on Hover or Focus

HoverActions

Edit and delete buttons appear at the end of a row when it is hovered, and also when anything inside it has focus through :focus-within, so keyboard users can reach them. On touch screens they are always visible.

View code
<ul class="hv5"><li><span>Homepage redesign</span><span class="acts"><button aria-label="Edit Homepage redesign">Edit</button><button aria-label="Delete Homepage redesign">Delete</button></span></li><li><span>Spring campaign</span><span class="acts"><button aria-label="Edit Spring campaign">Edit</button><button aria-label="Delete Spring campaign">Delete</button></span></li></ul>
.hv5 { width: 300px; max-width: 100%; margin: 0; padding: 0; list-style: none; font: 14px Inter, system-ui, sans-serif; }
.hv5 li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #e4e7ec; color: #101828; }
.hv5 li:hover { background: #f9fafb; }
.hv5 .acts { display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.hv5 li:hover .acts, .hv5 li:focus-within .acts { opacity: 1; }
.hv5 button { padding: 5px 9px; border: 1px solid #d0d5dd; border-radius: 6px; background: #fff; color: #344054; font: 600 12px Inter, system-ui, sans-serif; cursor: pointer; }
.hv5 button:last-child { color: #b42318; }
.hv5 button:focus-visible { outline: 2px solid #528bff; outline-offset: 1px; }
@media (hover: none) { .hv5 .acts { opacity: 1; } }

06. Settings Gear Turns on Hover

HoverIcon

A settings button whose gear icon turns a quarter on hover, a tiny confirmation that the pointer is on a control. The rotation is on the svg only, so the label stays still, and the turn is short enough not to distract.

View code
<button class="hv6"><svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1L7 17M17 7l2.1-2.1"/></svg>Settings</button>
.hv6 { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border: 1px solid #3a4670; border-radius: 10px; background: #151b2e; color: #e2e8f0; font: 600 14px Inter, system-ui, sans-serif; cursor: pointer; }
.hv6 svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.hv6:hover svg, .hv6:focus-visible svg { transform: rotate(90deg); }
.hv6:focus-visible { outline: 2px solid #818cf8; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .hv6 svg { transition: none; } }

07. Tile Colour Invert

HoverColour

Category tiles swap their background and text colours on hover, a bold and very readable effect for a grid. Both states pass contrast because they are the same two colours, just exchanged.

View code
<ul class="hv7"><li><a href="#shoes">Shoes</a></li><li><a href="#bags">Bags</a></li><li><a href="#hats">Hats</a></li><li><a href="#belts">Belts</a></li></ul>
.hv7 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: 240px; max-width: 100%; margin: 0; padding: 0; list-style: none; font: 800 16px Inter, system-ui, sans-serif; }
.hv7 a { display: grid; place-items: center; height: 70px; border: 2px solid #1e1b4b; border-radius: 12px; background: #fff; color: #1e1b4b; text-decoration: none; transition: background .2s, color .2s; }
.hv7 a:hover, .hv7 a:focus-visible { background: #1e1b4b; color: #fff; }
.hv7 a:focus-visible { outline: 3px solid #818cf8; outline-offset: 2px; }

About these CSS Hover Effects

Hover is a hint, not a requirement

Touch screens have no hover, so nothing important may depend on it. Actions that appear on hover must be visible on touch devices (@media (hover: none)) and reachable with the keyboard.

Mirror hover on focus

Copy each :hover rule to :focus-visible, or to :focus-within for containers, so keyboard users get the same feedback.

:has() for group effects

Effects that change the neighbours, like dimming the other links, need the parent to know a child is hovered. .nav:has(a:hover) a:not(:hover) does it without script.

Fast in, fast out

Interface hovers should respond in 150 to 300ms. Longer transitions make a page feel sluggish when the pointer moves across many items.

Frequently asked questions

How is this different from the button and card hover pages?

Those focus on one component; these are general patterns for lists, navs, tiles and icons.

Do hover effects affect performance?

Transform, opacity and colour changes are cheap. Avoid hovers that change layout sizes on large lists.

Should I disable hover effects for reduced motion?

Remove the movement; colour and opacity changes can stay.