Typewriter Effect

.typewriter h1 {
  overflow: hidden; /* Ensures the content is not revealed until the animation */
  border-right: .15em solid orange; /* The typwriter cursor */
  white-space: nowrap; /* Keeps the content on a single line */
  margin: 0 auto; /* Gives that scrolling effect as the typing happens */
  letter-spacing: .15em; /* Adjust as needed */
    typing 3.5s steps(40, end),
    blink-caret .75s step-end infinite;

/* The typing effect */
@keyframes typing {
  from { width: 0 }
  to { width: 100% }

/* The typewriter cursor effect */
@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: orange; }


  • Demo relies on flexbox, so that could affect the layout in testing
  • Assumes the use of Autoprefixer
  • The width of the text container will be determined by the length of the text being used
  • Adding more steps to the typing animation will increase the smoothness of the typing
  • Adjust the letter-spacing based on the font-family and font-size being used


Some use JavaScript, which may sometimes be preferable (literally adding a character at a time feels more like a real typewriter) and sometimes not be (potential accessibility concerns).

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.