Building CSS Typing Effect Day 142

Building CSS Typing Effect Day 142

·

1 min read

Today #Day142 of #365DaysOfCode, I am Building CSS Typing Effect.

HTML

<div class="wrapper">
        <div class="typing-demo">
            This is a typing demo.
        </div>
</div>

CSS

Centring Items,

.wrapper {
    height: 100vh;
    /*This part is important for centering*/
    display: grid;
    place-items: center;
}

styling the content,

.typing-demo {
  width: 22ch;
  animation: typing 2s steps(22), blink .5s step-end infinite alternate;
  white-space: nowrap;
  overflow: hidden;
  border-right: 3px solid;
  font-family: monospace;
  font-size: 2em;
}

adding keyframes for typing animation,

@keyframes typing {
  from {
    width: 0
  }
}

adding keyframes for blinking cursor animation,

we are blinking the border,

@keyframes blink {
  50% {
    border-color: transparent
  }
}

Conclusion

I completed Building CSS Typing Effect.

Code

  1. code

    preview

Source: CSS Typing Effect[Link]

Author: Dheeraj.y

Connect with me: