AI CSS Animations

Sticky Note Typing Animation

A reminder types itself onto a tilted sticky note with ruled lines and a strip of tape. The count of letter delays runs across both lines, so the second line starts right where the first ends.

Also known as: post it note animation css, note typing effect, handwritten note typing.

HTML

<div class="txt-sticky-note-typing" aria-label="Call Mia at 6. Bring cake!">
  <span class="txt-sticky-note-typing-t" aria-hidden="true"><span class="txt-sticky-note-typing-line"><span style="--i: 0">C</span><span style="--i: 1">a</span><span style="--i: 2">l</span><span style="--i: 3">l</span><span style="--i: 4">&nbsp;</span><span style="--i: 5">M</span><span style="--i: 6">i</span><span style="--i: 7">a</span><span style="--i: 8">&nbsp;</span><span style="--i: 9">a</span><span style="--i: 10">t</span><span style="--i: 11">&nbsp;</span><span style="--i: 12">6</span></span><span class="txt-sticky-note-typing-line"><span style="--i: 13">B</span><span style="--i: 14">r</span><span style="--i: 15">i</span><span style="--i: 16">n</span><span style="--i: 17">g</span><span style="--i: 18">&nbsp;</span><span style="--i: 19">c</span><span style="--i: 20">a</span><span style="--i: 21">k</span><span style="--i: 22">e</span><span style="--i: 23">!</span></span></span>
</div>

CSS

.txt-sticky-note-typing {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  position: relative;
  display: inline-block;
  box-sizing: content-box;
  width: 8.5em;
  padding: 0.9em 1em 0.7em;
  font-family: "Marker Felt", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  font-size: calc(var(--txt-size, 32px) * 0.72);
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  color: #3b3322;
  background:
    repeating-linear-gradient(transparent 0 calc(1.6em - 1px), rgb(59 51 34 / 0.14) calc(1.6em - 1px) 1.6em) 0 0.9em / 100% calc(100% - 1.6em) no-repeat,
    #fde68a;
  border-radius: 0.1em 0.1em 0.5em 0.1em;
  box-shadow: 0 0.5em 0.8em -0.5em rgb(0 0 0 / 0.35);
  transform: rotate(-2deg);}
/* a strip of tape in the accent color */
.txt-sticky-note-typing::before {
  content: "";
  position: absolute;
  top: -0.35em;
  left: 50%;
  width: 3em;
  height: 0.8em;
  margin-left: -1.5em;
  background: color-mix(in srgb, var(--c) 45%, transparent);
  transform: rotate(3deg);
}
.txt-sticky-note-typing-line {
  display: block;
  white-space: nowrap;
}
.txt-sticky-note-typing-t span span {
  position: relative;
  opacity: 0;
  animation: txt-sticky-note-typing-key 0s calc(0.3s + var(--i) * 90ms) forwards;
}
.txt-sticky-note-typing-t span span::after {
  content: "";
  position: absolute;
  top: 0.2em;
  bottom: 0.15em;
  right: -0.06em;
  width: 0.07em;
  background: var(--c);
  opacity: 0;
  animation: txt-sticky-note-typing-caret 90ms step-end calc(0.3s + var(--i) * 90ms);
}
.txt-sticky-note-typing-line:last-child span:last-child::after {
  animation: txt-sticky-note-typing-blink 1s step-end calc(0.3s + var(--i) * 90ms) infinite;
}
@keyframes txt-sticky-note-typing-key {
  to { opacity: 1; }
}
@keyframes txt-sticky-note-typing-caret {
  0%, 100% { opacity: 1; }
}
@keyframes txt-sticky-note-typing-blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .txt-sticky-note-typing, .txt-sticky-note-typing *, .txt-sticky-note-typing::before, .txt-sticky-note-typing::after, .txt-sticky-note-typing *::before, .txt-sticky-note-typing *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations