About this snippet

Learn how to create a stunning animated gradient text effect using only CSS. This modern technique makes text stand out with flowing colors, perfect for headlines or branding.

Size
876 bytes
Uses
HTML, CSS
Loads
Nothing external
Views
703
<h1 class="animated-gradient-text">Hello World</h1>
/* Basic body styling for contrast */
body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #222;
  margin: 0;
}

.animated-gradient-text {
  font-size: 4rem;
  font-family: Arial, sans-serif;
  font-weight: bold;
  background: linear-gradient(90deg, #ff00ff, #00ffff, #ff00ff);
  background-size: 200% auto;
  color: #fff; /* Fallback for browsers that don't support background-clip */
  background-clip: text;
  -webkit-background-clip: text;
  text-fill-color: transparent;
  -webkit-text-fill-color: transparent;
  animation: gradient-flow 4s linear infinite;
  display: inline-block; /* Ensures background-clip works correctly */
}

@keyframes gradient-flow {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 200% center;
  }
}
Esc
↑↓ moveEnter select

Start from a template

Open an .html file, or HTML, CSS, JS, Markdown, Less or TypeScript files. You can also drop them here. Styles and scripts go into their panes.

Share

Source

Keyboard shortcuts

Save