AI CSS Animations

Embossed Text Effect

Raised letters with a lit edge and a shadowed edge, and the light slowly circles around them. Two text-shadows swap sides through eight keyframes, so the bevel turns smoothly.

Also known as: letterpress text css, emboss text with moving light, raised text shadow.

Letterpress

HTML

<div class="txt-emboss-text">Letterpress</div>

CSS

.txt-emboss-text {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.02em;
  color: var(--c);
  text-shadow: -0.035em -0.035em 0 color-mix(in srgb, var(--c) 30%, #fff), 0.035em 0.035em 0.02em color-mix(in srgb, var(--c) 50%, #000);
  animation: txt-emboss-text-orbit 6s linear infinite;}
@keyframes txt-emboss-text-orbit {
  0%, 100% { text-shadow: -0.035em -0.035em 0 color-mix(in srgb, var(--c) 30%, #fff), 0.035em 0.035em 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  12.5%    { text-shadow: 0 -0.05em 0 color-mix(in srgb, var(--c) 30%, #fff), 0 0.05em 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  25%      { text-shadow: 0.035em -0.035em 0 color-mix(in srgb, var(--c) 30%, #fff), -0.035em 0.035em 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  37.5%    { text-shadow: 0.05em 0 0 color-mix(in srgb, var(--c) 30%, #fff), -0.05em 0 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  50%      { text-shadow: 0.035em 0.035em 0 color-mix(in srgb, var(--c) 30%, #fff), -0.035em -0.035em 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  62.5%    { text-shadow: 0 0.05em 0 color-mix(in srgb, var(--c) 30%, #fff), 0 -0.05em 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  75%      { text-shadow: -0.035em 0.035em 0 color-mix(in srgb, var(--c) 30%, #fff), 0.035em -0.035em 0.02em color-mix(in srgb, var(--c) 50%, #000); }
  87.5%    { text-shadow: -0.05em 0 0 color-mix(in srgb, var(--c) 30%, #fff), 0.05em 0 0.02em color-mix(in srgb, var(--c) 50%, #000); }
}

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

Customizing this snippet

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