This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

CSS Practical Tricks & Techniques Cheat Sheet

A curated collection of practical CSS snippets: text-rendering legibility, iOS smooth scrolling, gradient text, text stroke, and touch optimizations.

· Published

A curated reference of practical CSS techniques, cross-browser typography enhancements, and mobile viewport styling tricks.

Typographic Legibility & Ligatures

Enables kerning pairs and optional ligatures for headline text:

h1, h2, h3 {
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

Gradient Text Effect

Render linear gradients directly inside typography:

.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

Text Stroke Outline

Add an outline stroke to text glyphs:

.stroked-heading {
  -webkit-text-stroke: 1.5px #111;
  color: white;
}

Mobile Touch & WebKit Optimizations

Disable default mobile tap highlights and touch callout action sheets:

* {
  /* Remove mobile tap highlight box */
  -webkit-tap-highlight-color: transparent;
  /* Disable iOS context menu on long press */
  -webkit-touch-callout: none;
}

/* Remove focus outline on link clicks while preserving keyboard tab focus */
a:focus:not(:focus-visible) {
  outline: none;
}

Hardware-Accelerated Smooth Momentum Scrolling

.scroll-container {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Momentum scrolling on older iOS Safari */
  overscroll-behavior-y: contain;    /* Prevent pull-to-refresh chaining */
}

Related topics