Math for Web Design

you own this product
Precision layout and animation
  • June 2026
  • ISBN 9781633434820
  • 400 pages
  • printed in black & white

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Look inside
"A necessity for designing bulletproof layouts.”
—Chris Kardell, Centennial Bank


Math for Web Design: Precision layout and animation explains the mathematical principles behind good frontend design. With his engaging writing, author Paul McFedries makes it clear how math, carefully applied in CSS and JavaScript, solves everyday design problems such as distributing space, choosing accessible colors, positioning elements, and making animation feel natural. When you understand the calculations behind color, geometry, and motion, you can design with more precision, debug behavior more confidently, and create interfaces that are both attractive and functional.

You’ll start with the basics. Early chapters introduce the minimum math you need, then connect it immediately to front-end tools. From there, the book moves into real layout systems, showing how CSS units are computed, how inheritance affects sizes, how the box model changes formulas, and how Grid and Flexbox distribute space.

The middle chapters focus on responsive and visual decisions that define modern web design. You’ll work through percentage-based and viewport-based layouts, media query logic, liquid layouts, and custom clamp() formulas. You’ll also learn the mathematics of color, including color conversion, harmonious palettes, WCAG contrast ratios, alpha compositing, and blend modes. Typography receives the same practical treatment, with formulas for font size, line height, line length, fluid type, and modular scales.

Later chapters move into the math of interaction, motion, and richer UI effects. You’ll use trigonometry for circular menus, spinners, wave paths, and directional calculations, along with vectors and geometry to align components, create hover and parallax effects, and constrain dragging. The book then extends this foundation into Bezier curves, CSS easing, gesture math, and scroll-based animation.

Math for Web Design is a masterful guided tour through the math front-end professionals actually use. Each concept appears because it solves a concrete design or implementation problem. CSS and JavaScript examples keep the explanations grounded, while exercises and solutions help you build fluency. You’ll appreciate how this book builds a durable mental model layer by layer, connecting fundamentals to layout, color, typography, animation, interaction, and canvas work in a sequence you can revisit as a practical reference.

what's inside

  • CSS and JavaScript math fundamentals
  • Grid, Flexbox, responsive layout, and fluid sizing
  • Color, accessibility, typography, and blending
  • Geometry, trigonometry, interaction, and animation math

about the reader

For developers, designers, and UX/UI professionals who know CSS and JavaScript. No advanced math knowledge required.

about the author

Paul McFedries has been a professional technical writer for more than 30 years. He is the author of Manning’s Web Design Playground, Second Edition, and Build a Website with ChatGPT. His 100+ books have sold more than 4 million copies worldwide.

Well structured and easy to digest.

Majeed Siddiqui, Amazon

A good guide for beginners to learn precise web design. An interesting reading.

Denis Saripov, TikTok

Offers a fresh perspective—not just as a typical frontend resource, but as a guide to understanding and applying mathematical concepts in real projects.

Rashed Hoque, Baker Hughes Reservoir Software B.V

Brilliant resource for any web developer looking to level up their confidence.

Victor Jones, Lotto NZ

Understanding these principles gives the reader a significant advantage in creative problem solving for the web.

Seth MacPherson, Quote Factory

Well written, well explained.

Giorgio Vilardo, Nearform

Covers the topic well, and teaches it well.

Isabel Rapando, Vocanter LLC

A detailed but approachable guide to an important subject.

Amit Lamba, Indus Multifoods
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Math for Web Design ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Math for Web Design ebook for free