33 Pure CSS2 with JSPublished 2026-10-05Free · no sign-up
Hover effects for every part of an interface on one page: everyday UI hovers, link underlines, text reveals, image zooms and overlays, and button hovers. The core set: 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.
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>
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.
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.
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.
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>
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.
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.
The underline grows from the left on hover and leaves to the right when the pointer moves away, which feels like it passed through. The trick is changing transform-origin between the two states, so each direction scales from a different side.
View code
<p class="lk1">Read our <a href="#guide">shipping guide</a> before you order.</p>
A thin coloured underline at rest becomes a full highlight behind the text on hover, because the background gradient's height animates from 2px to 100 percent. The text colour stays dark on the pale highlight for contrast.
View code
<p class="lk2">Browse the <a href="#archive">full archive</a> or <a href="#search">search</a>.</p>
A standalone call-to-action link whose arrow nudges right on hover, hinting at going somewhere. The arrow is an aria-hidden span so the accessible name is just the words, and the movement is a transform on the arrow only.
View code
<a class="lk3" href="#case-study">Read the case study <span aria-hidden="true">→</span></a>
A native text underline that moves closer and thickens on hover, using text-underline-offset and text-decoration-thickness. Real underlines respect descenders with text-decoration-skip-ink, which a pseudo-element underline cannot do.
View code
<p class="lk4">Questions? <a href="#help">Visit the help centre</a> or reply to any email.</p>
Links to other sites get a small arrow-out icon that lifts on hover, added automatically with an attribute selector on href^="http". A visually hidden note says it opens another website, which matters when the link leaves your site.
View code
<p class="lk5">Built with <a href="https://developer.mozilla.org/">MDN's guides<span class="sr"> (external site)</span></a> as reference.</p>
A pill-shaped highlight slides between nav links to follow the hovered or focused one, and settles on the current page when the pointer leaves. A few lines of script measure the link and move one absolutely positioned pill with transform.
var nav = document.querySelector('.lk6'), pill = nav.querySelector('.pill'), cur = nav.querySelector('[aria-current]');
function to(a) { pill.style.width = a.offsetWidth + 'px'; pill.style.transform = 'translateX(' + a.offsetLeft + 'px)'; }
nav.querySelectorAll('a').forEach(function (a) { a.addEventListener('mouseenter', function () { to(a); }); a.addEventListener('focus', function () { to(a); }); });
nav.addEventListener('mouseleave', function () { to(cur); }); nav.addEventListener('focusout', function (e) { if (!nav.contains(e.relatedTarget)) to(cur); });
to(cur);
14. Dotted Underline Turns Solid
LinkGlossary
A glossary-style term with a dotted underline that turns solid and changes colour on hover, a convention readers recognise as a definition link. It uses text-decoration-style, so it wraps across lines correctly, unlike a border-bottom.
View code
<p class="lk7">Our checkout passes <a href="#glossary-pci">PCI DSS</a> checks every quarter.</p>
Hovering a heading sweeps a second colour across the letters from left to right. The heading has a two-colour background split at 50 percent, clipped to the text and twice as wide, and hover shifts its position. Focus within the card triggers it too.
On hover the label slides up out of view and an identical copy slides up into its place, a crisp effect for nav items and buttons. The copy is a pseudo-element reading the text from a data attribute, so it is not read twice by screen readers.
Uppercase text spreads its letters apart on hover, a refined effect for fashion and luxury menus. The link has a fixed width and centred text so expanding letters do not push the items around it.
Stacked text-shadows build a solid 3D extrusion under the word, and on hover the text rises while the extrusion lengthens. Each shadow layer is 1px further down and to the right, and the hover state adds layers for the deeper look.
Each letter turns a full circle on the y-axis in sequence when the word is hovered. Letters are spans with an index for the delay, wrapped in an element with an aria-label holding the whole word, and the spans are aria-hidden.
A line draws through the old price when the line is hovered, useful for prices, to-do items or a playful menu. It is decoration only, since the words Was and now already carry the meaning. The line is a pseudo-element scaled from zero along the x axis with a slight skew.
View code
<p class="th6">Was <span>$120</span> now <b>$84</b></p>
Part of the headline is covered by a solid block that slides away on hover or focus to reveal the punchline. The hidden words are still real text in the DOM, so screen readers read the full sentence whether or not the block has moved.
The image scales up slightly inside a fixed frame on hover, the most common image hover there is. The frame has overflow: hidden and the link around it carries the focus style, so the same zoom shows for keyboard users.
View code
<a class="ih1" href="#journal"><span class="fr"><span class="im" role="img" aria-label="Coffee and notebook on a desk"></span></span><span class="t">How we plan a product launch</span></a>
Team photos sit in grayscale and come to life in colour when hovered or focused, a neat way to keep a grid of mixed photos looking consistent. It is a filter transition, so the image itself never changes.
A caption panel slides up from the bottom edge on hover or focus, with a gradient behind it so the white text stays readable over any photo. On touch screens the caption is always visible.
View code
<a class="ih3" href="#villa"><span class="im" role="img" aria-label="White villa above the sea"></span><span class="cap"><b>Villa Azul</b> Sleeps 6 · from €240 a night</span></a>
A dark overlay and a magnifier icon fade in over the image to say it opens larger. The link's accessible name says Open larger image of a red tram, which describes both the image and what the click does.
View code
<a class="ih4" href="#tram-large" aria-label="Open larger image of a red tram"><span class="im" aria-hidden="true"></span><span class="ov" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="6"/><path d="M20 20l-4.5-4.5M11 8v6M8 11h6"/></svg></span></a>
In a gallery, hovering one image blurs and dims the rest so the chosen one stands out. :has() on the grid detects that something inside is hovered and styles every image that is not, with no JavaScript.
A colour wash in two brand colours sits over the image with mix-blend-mode, turning any photo into an on-brand duotone; hover lifts the wash to show the original. It is a common way to make stock photos feel part of one design.
View code
<a class="ih6" href="#story"><span class="im" role="img" aria-label="Mountain lake at dawn"></span><span class="wash" aria-hidden="true"></span><span class="t">Read the story</span></a>
A thin white frame draws itself inside the image edge on hover, a gallery-style touch for portfolios. The frame is an outline on a pseudo-element with a negative offset, scaling in from slightly larger, so it never affects the layout.
View code
<a class="ih7" href="#series"><span class="im" role="img" aria-label="Abstract blue and orange painting"></span></a>
An outlined button fills with colour from the bottom edge up on hover and focus, and the text colour flips to stay readable. The fill is a pseudo-element scaled on the y axis, kept behind the label with a negative z-index inside an isolated button.
On hover the label slides off to the right and an arrow slides in from the left to take its place. Both live in the button the whole time; the arrow is aria-hidden, so the accessible name is always the label text.
Two L-shaped borders sit in opposite corners and grow along the edges until they meet, forming a full frame. They are the button's ::before and ::after with only two borders each, and their width and height transition together.
A bold neo-brutalist button with a hard offset shadow. Hover pulls it further from its shadow and pressing pushes it flat into the shadow, so the button feels physical. The shadow is a box-shadow with no blur.
Two halves of colour slide in from both sides and meet in the middle on hover. Each half is a pseudo-element half the button's width, scaled from its own outer edge, which gives a curtain-closing feel.
The button leans toward the pointer as it approaches and springs back when it leaves, a playful effect for one hero action. Script moves it a fraction of the pointer's distance from its centre with transform, and does nothing when reduced motion is set.
var area = document.querySelector('.bh6'), b = area.querySelector('button');
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) {
area.addEventListener('pointermove', function (e) { var r = b.getBoundingClientRect(), x = e.clientX - (r.left + r.width / 2), y = e.clientY - (r.top + r.height / 2); b.style.transform = 'translate(' + x * .25 + 'px,' + y * .35 + 'px)'; });
area.addEventListener('pointerleave', function () { b.style.transform = ''; });
}
35. Diagonal Skewed Fill
ButtonHover
A slanted block of colour slides across the button from the left, with its leading edge angled by skewX. The block starts outside the button, wider than it so the slant never leaves a gap, and overflow: hidden trims it to the rounded shape.
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.