Toggle navigation
☰
HTML
CSS
Scripting
Database
<!doctype html> <title>Example</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; font-family: 'Courier New', Courier, monospace; /* Monospace is best for this */ background-color: #f0f0f0; } .typewriter-container { display: inline-block; } .typewriter-text { overflow: hidden; /* Ensures the text isn't revealed until the animation */ white-space: nowrap; /* Keeps the text on a single line */ margin: 0 auto; /* Gives that scrolling effect as the typing happens */ letter-spacing: .15em; /* Adjust as needed */ font-size: 2rem; font-weight: bold; color: #333; /* The typing cursor */ border-right: .15em solid orange; /* 1. typing: Animates width from 0 to 100% using steps() based on char count. 2. blink-caret: Flashes the border on and off. */ animation: typing 3.5s steps(30, end), blink-caret .75s step-end infinite; } /* The typing effect */ @keyframes typing { from { width: 0 } to { width: 100% } } /* The typewriter cursor blink */ @keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: orange; } } @media (prefers-reduced-motion: reduce) { .typewriter-text { animation: none; /* Disables both typing and blinking */ width: 100%; /* Ensure text is fully visible immediately */ border-right: none; /* Remove the cursor */ } } </style> <div class="typewriter-container"> <div class="typewriter-text">Hello, welcome to my website!</div> </div>