AI CSS Animations

Neo Brutalist Button

A flat, loud neo brutalist button with a hard offset shadow. On hover it slides into its shadow like a key pressed down. Border and shadow use currentColor, so they follow your text color.

Also known as: neubrutalism button, brutalist button css, hard shadow press.

HTML

<button class="btn-brutalist"><span class="btn-brutalist-label">Get started</span></button>

CSS

.btn-brutalist {
  --c: var(--btn-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font: 600 var(--btn-size, 18px)/1.2 system-ui, sans-serif;
  cursor: pointer;
  padding: 0.75em 1.5em;
  border: 2px solid currentColor;
  border-radius: 0.35em;
  background: var(--c);
  color: inherit;
  box-shadow: 0.3em 0.3em 0 currentColor;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;}
.btn-brutalist-label {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.btn-brutalist:is(:hover, :focus-visible) {
  transform: translate(0.3em, 0.3em);
  box-shadow: 0 0 0 currentColor;
}

@media (prefers-reduced-motion: reduce) {
  .btn-brutalist, .btn-brutalist *, .btn-brutalist::before, .btn-brutalist::after, .btn-brutalist *::before, .btn-brutalist *::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-md border-2 border-gray-900 bg-blue-500 px-6 py-3 font-extrabold text-white shadow-[4px_4px_0_#111827] transition duration-100 hover:translate-x-1 hover:translate-y-1 hover:shadow-none">
  Get started
</button>

Customizing this snippet

  • Color: set --btn-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --btn-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 18px.
  • 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 buttons