Skip to content

Instantly share code, notes, and snippets.

@FeMaffezzolli
Created October 17, 2021 02:20
Show Gist options
  • Save FeMaffezzolli/884e4c6bfa2c1d6fab8b912da2073dff to your computer and use it in GitHub Desktop.
Save FeMaffezzolli/884e4c6bfa2c1d6fab8b912da2073dff to your computer and use it in GitHub Desktop.
Pure CSS Typing Animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto Mono', monospace;
}
@keyframes typing {
from { width: 0 }
}
@keyframes caret {
50% { border-color: transparent; }
}
h1 {
width: 14ch; /* Width of text */
overflow: hidden;
white-space: nowrap;
border-right: .05em solid;
animation: typing 2s steps(14),
caret 1s steps(1) infinite;
}
</style>
</head>
<body>
<h1>Felipe Santana</h1>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment