JSFiddle - React, Tailwind, and code Playground

by velo_ninja

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Rotating Text Hero Effect</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Arial', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }

        .hero-container {
            text-align: center;
            color: white;
            max-width: 800px;
            padding: 2rem;
        }

        .hero-text {
            font-size: 4rem;
            font-weight: bold;
            line-height: 1.2;
            margin-bottom: 1rem;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        }

        .rotating-text-container {
            display: inline-block;
            position: relative;
            min-width: 300px;
            height: 1.2em;
            vertical-align: top;
        }

        .rotating-word {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            opacity: 0;
            transform: translateY(30px);
            transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            color: #FFD700;
            font-weight: 900;
        }

        .rotating-word.active {
            opacity: 1;
            transform: translateY(0);
        }

        .rotating-word.fade-out {
            opacity: 0;
            transform: translateY(-30px);
        }

        .subtitle {
            font-size: 1.2rem;
            font-weight: 300;
            opacity: 0.9;
            margin-top: 2rem;
            animation: fadeInUp 1s ease-out 0.5s both;
        }

 ...