AI CSS Animations

Skew Hover Effect

The outlined button leans into a slant on hover. This one skews from the center; set transform-origin to the bottom edge for Hover.css Skew Forward, or flip the angle for Skew Backward.

Also known as: hvr-skew, hvr-skew-forward, slant button on hover.

HTML

<button class="hfx-skew">Read more</button>

CSS

.hfx-skew {
  --c: var(--hfx-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.6em;
  border-radius: 0.5em;
  font: 600 var(--hfx-size, 16px) system-ui, sans-serif;
  cursor: pointer;
  border: 2px solid var(--c);
  background: transparent;
  color: var(--c);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.3s ease;}
.hfx-skew:is(:hover, :focus-visible) {
  transform: skewX(-10deg);
  background: color-mix(in srgb, var(--c) 10%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .hfx-skew, .hfx-skew *, .hfx-skew::before, .hfx-skew::after, .hfx-skew *::before, .hfx-skew *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Tailwind CSS version

The same effect using Tailwind utility classes. No custom CSS or config needed.

<button class="rounded-lg border-2 border-blue-500 px-6 py-3 font-semibold text-blue-500 transition duration-300 ease-out hover:-skew-x-[10deg] hover:bg-blue-500/10">
  Read more
</button>

Customizing this snippet

  • Color: set --hfx-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hfx-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hover effects