CSS Sliced Text Hover
A word cut diagonally in two with clip-path, the halves sliding apart on hover or focus.
<a class="text-slice" href="#">
<span>SLICE</span>
<span aria-hidden="true">SLICE</span>
</a>
.text-slice {
display: inline-grid;
color: #18181b;
font: 900 52px/1 system-ui, sans-serif;
letter-spacing: 0.02em;
text-decoration: none;
}
.text-slice span {
grid-area: 1 / 1;
transition: transform 0.35s cubic-bezier(0.3, 0.7, 0.2, 1), color 0.35s ease;
}
.text-slice span:first-child {
clip-path: polygon(0 0, 100% 0, 100% 40%, 0 62%);
}
.text-slice span:last-child {
clip-path: polygon(0 62%, 100% 40%, 100% 100%, 0 100%);
}
.text-slice:hover span:first-child,
.text-slice:focus-visible span:first-child {
transform: translate(-6px, -2px);
}
.text-slice:hover span:last-child,
.text-slice:focus-visible span:last-child {
color: #e11d48;
transform: translate(6px, 2px);
}
.text-slice:focus-visible {
outline: 2px solid #18181b;
outline-offset: 8px;
}
@media (prefers-reduced-motion: reduce) {
.text-slice span { transition: color 0.35s ease; }
}
About this CSS Sliced Text Hover
This CSS Sliced Text Hover is 40 lines of pure CSS (0.9 KB) with no JavaScript and no dependencies. It uses transitions, transforms, clip paths and CSS Grid. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#18181b#e11d48
How to use this sliced text hover
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.text-sliceclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.