How to Create Hand-Drawn Highlighter & Sketchy Annotation Effects in CSS

The Quick Answer

To create realistic hand-drawn highlighter and sketchy annotation effects in CSS, layer a translucent marker wash behind text using background: linear-gradient(104deg, rgba(254, 240, 138, 0) 0.9%, rgba(254, 240, 138, 0.75) 2.4%, rgba(254, 240, 138, 0.5) 98%) with a tilted transform: rotate(-1deg) or irregular border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px. For sketchy underlines and circles, animate SVG path stroke-dasharray and stroke-dashoffset with rough irregular line contours.

Interactive Demo Live Preview
Highlight key concepts with organic marker pen textures in pure CSS!

Step 1: The Irregular Border Radius Secret for Marker Shapes

Perfect straight rectangles look artificial. Authentic hand-drawn highlighter strokes have slight wobble and uneven corner tapering. Using CSS 8-value irregular border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px gives boxes that organic, human feel.

marker-box.css
.hand-drawn-highlight {
  position: relative;
  display: inline-block;
  color: #0f172a;
}

.hand-drawn-highlight::before {
  content: "";
  position: absolute;
  inset: -2px -4px;
  background: #fef08a; /* Pastel Yellow Marker Wash */
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  transform: rotate(-1.2deg);
  z-index: -1;
  opacity: 0.85;
}

Step 2: Animated SVG Sketchy Underlines with stroke-dashoffset

For animated sketchy underlines that draw themselves across the page as the user scrolls, use an SVG path with slight bezier curve imperfections and animate stroke-dashoffset from 100% to 0%.

sketch-underline.svg
/* Animated hand-drawn SVG underline wipe */
.sketch-line {
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawLine 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

Step 3: Combining feTurbulence Noise with SVG Stroke Filters

To turn completely straight vector lines into textured pencil or crayon sketches, apply an SVG <feDisplacementMap> filter driven by <feTurbulence> noise. The filter physically distorts the vector edges.

rough-filter.svg
<svg width="0" height="0">
  <filter id="sketch-rough">
    <feTurbulence type="fractalNoise" baseFrequency="0.05" numOctaves="4" result="noise" />
    <feDisplacementMap in="SourceGraphic" in2="noise" scale="3" xChannelSelector="R" yChannelSelector="G" />
  </filter>
</svg>

Step 4: Scroll-Triggered Highlighter Reveal with CSS Animation Timelines

Link the highlighter animation directly to scroll coordinates using CSS Scroll-Driven Animations: as the paragraph scrolls into the viewport, the marker pen wash sweeps smoothly across the words.

scroll-highlight.css
.scroll-marker {
  background: linear-gradient(104deg, #fef08a 0%, #fef08a 100%) no-repeat;
  background-size: 0% 100%;
  animation: sweepMarker ease-out forwards;
  animation-timeline: view();
  animation-range: entry 20% cover 40%;
}

@keyframes sweepMarker {
  to { background-size: 100% 100%; }
}

Next-Level Addons: Elevating Your Implementation

Take this technique further by combining it with complementary design token studios and animation tools:

Marker Style: Rough Chalk #fef08a

1. Highlighter & Annotation Studio in Interaction Studio

Explore in Highlighter Studio →

Experiment with pastel marker palette swatches, hand-drawn circle annotations, sketchy arrows, and rough border widths.

2. Hand-Drawn Shapes in Blob Shape Generator

Explore in Blob Shape Generator →

Generate amorphous SVG seed shapes to use as organic marker backdrops and highlight tags.

animation-timeline: view(block);

3. Scroll-Driven Animation in Scroll Animation Studio

Explore in CSS Scroll-Driven Animation Guide →

Link your hand-drawn highlighter stroke-dashoffset directly to user scroll progress via animation-timeline: view().

Chaam
Chaam's Pro Tip

A trick I use in almost every project: don't fight specificity battles with !important. Leverage modern CSS cascade layers (@layer) and CSS variables as design tokens—it makes dark/light theme switching and responsive tuning effortless.

Why I Built the Highlighter Studio

I got tired of guessing values and testing browser quirks in DevTools, so I built this tool to tweak and preview values in real time with 1-click code export.

Open in Highlighter Studio ↗

Frequently Asked Questions

Practical answers to common implementation questions, browser quirks, and performance tips.

How does the 8-value border-radius property create hand-drawn shapes?

Standard border-radius applies symmetric curves. Using 8 values separated by a slash (e.g. 255px 15px 225px 15px / 15px 225px 15px 255px) defines independent horizontal and vertical radii for all four corners, creating organic, imperfect wobbles.

How do I animate an SVG hand-drawn underline across text?

Set stroke-dasharray equal to the total path length, set stroke-dashoffset to the same value, and animate stroke-dashoffset to 0 on hover or scroll.

Can hand-drawn highlighter effects be applied to multi-line paragraphs?

Yes. By applying the marker background as a linear-gradient with box-decoration-break: clone (and -webkit-box-decoration-break: clone), the highlighter wraps neatly across every line of text.

What is feTurbulence and how does it make lines look rough?

feTurbulence is an SVG filter primitive that generates Perlin fractal noise. When paired with feDisplacementMap, it displaces the pixels along vector strokes to mimic paper grain and pencil texture.

What are the best colors for highlighter text annotations?

Pastel marker tones work best: Pastel Yellow (#fef08a), Fluorescent Lime (#bbf7d0), Cyan Glow (#bae6fd), and Soft Pink (#fbcfe8), keeping opacity around 70–85%.

← Back to all blog guides Launch Generator Studio →