AI CSS Animations

Hello in Different Languages Animation

A greeting cycles through five languages, each one easing in from wide letter spacing with the language name underneath. Good for welcome screens and international landing pages.

Also known as: hello in many languages css, multilingual greeting animation, welcome text rotator.

Hello Bonjour Hola Ciao こんにちは

HTML

<div class="txt-hello-in-languages-text">
  <span class="txt-hello-in-languages-text-hello">
    <span style="--i: 0">Hello</span>
    <span style="--i: 1">Bonjour</span>
    <span style="--i: 2">Hola</span>
    <span style="--i: 3">Ciao</span>
    <span style="--i: 4">こんにちは</span>
  </span>
  <span class="txt-hello-in-languages-text-lang" aria-hidden="true">
    <span style="--i: 0">English</span>
    <span style="--i: 1">Français</span>
    <span style="--i: 2">Español</span>
    <span style="--i: 3">Italiano</span>
    <span style="--i: 4">日本語</span>
  </span>
</div>

CSS

.txt-hello-in-languages-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;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2em;
  white-space: nowrap;}
.txt-hello-in-languages-text-hello,
.txt-hello-in-languages-text-lang {
  display: grid;
  justify-items: center;
}
.txt-hello-in-languages-text-hello {
  font-size: 1.35em;
  color: var(--c);
}
.txt-hello-in-languages-text-lang {
  font-size: 0.45em;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.6;
}
.txt-hello-in-languages-text-hello span {
  grid-area: 1 / 1;
  /* 5 greetings x 1.8s = 9s */
  animation: txt-hello-in-languages-text-in 9s cubic-bezier(0.2, 0.7, 0.2, 1) infinite;
  animation-delay: calc(var(--i) * 1.8s - 9.7s);
}
.txt-hello-in-languages-text-lang span {
  grid-area: 1 / 1;
  animation: txt-hello-in-languages-text-fade 9s cubic-bezier(0.2, 0.7, 0.2, 1) infinite;
  animation-delay: calc(var(--i) * 1.8s - 9.7s);
}
.txt-hello-in-languages-text-hello span:not(:first-child),
.txt-hello-in-languages-text-lang span:not(:first-child) {
  opacity: 0;
}
@keyframes txt-hello-in-languages-text-in {
  0%     { opacity: 0; letter-spacing: 0.3em; filter: blur(0.06em); }
  7.78% { opacity: 1; letter-spacing: 0; filter: blur(0); }
  16.11% {
    opacity: 1; letter-spacing: 0; filter: blur(0);
    animation-timing-function: cubic-bezier(0.5, 0, 0.75, 0);
  }
  20%, 100% { opacity: 0; letter-spacing: -0.02em; filter: blur(0.06em); }
}
@keyframes txt-hello-in-languages-text-fade {
  0%     { opacity: 0; }
  7.78% { opacity: 1; }
  16.11% { opacity: 1; }
  20%, 100% { opacity: 0; }
}

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