AI CSS Animations

Glass Text Effect

Tinted, see-through letters with a bright rim, a glossy top and a reflection that drifts across as they tilt. The tint is a translucent accent, and they cast a soft colored shadow.

Also known as: glassmorphism text, transparent glass letters css, frosted glass text.

Crystal Clear

HTML

<div class="txt-glass-text">Crystal Clear</div>

CSS

.txt-glass-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-weight: 900;
  background:
    linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 0.75) 45%, rgb(255 255 255 / 0.15) 55%, transparent 65%) 0 0 / 250% 100%,
    linear-gradient(180deg, rgb(255 255 255 / 0.5), rgb(255 255 255 / 0) 50%),
    color-mix(in srgb, var(--c) 40%, transparent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: max(1px, 0.015em) color-mix(in srgb, var(--c) 85%, transparent);
  filter: drop-shadow(0 0.08em 0.08em color-mix(in srgb, var(--c) 30%, transparent));
  animation: txt-glass-text-tilt 4s ease-in-out infinite alternate;}
@keyframes txt-glass-text-tilt {
  from { background-position: 100% 0, 0 0; }
  to   { background-position: 0% 0, 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .txt-glass-text, .txt-glass-text *, .txt-glass-text::before, .txt-glass-text::after, .txt-glass-text *::before, .txt-glass-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