liveBook · Manning

Chapter 13: Gradients, shadows, and blend modes

What you will learn in chapter 13 of CSS in Depth, Second Edition

Introduces visual effects through a button whose gradient and shadow create an illusion of depth.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces visual effects through a button whose gradient and shadow create an illusion of depth.

Key terms: background gradient, drop shadow, illusion of depth

13.1 Gradients

Introduces CSS gradients as background images, explains how to make a basic linear gradient visible, and shows how to control its direction.

Key terms: background, shorthand property, individual properties, background-image, linear-gradient(), gradient, to right, deg, starting color, ending color

13.1.1 Multiple color stops

This section shows how multiple color stops create smooth transitions, hard-edged stripes, and repeating stripe patterns in CSS gradients.

Key terms: linear-gradient(), color stop, stripes, repeating-linear-gradient(), repeating gradients

13.1.2 Color interpolation

This section explains how color spaces and hue paths change a gradient’s intermediate colors, how to specify them in CSS, and how to handle browser limitations.

Key terms: color interpolation, sRGB, OKLCH, gray dead zone, in keyword, color space, fallback gradient, polar color spaces, shorter hue, longer hue

13.1.3 Radial gradients

This section explains how radial gradients spread from a point, how to control their shape and placement, and how to repeat them in rings.

Key terms: radial gradient, radial-gradient(), elliptical, color stops, circle, at, repeating-radial-gradient(), concentric rings

13.1.4 Conic gradients

This section explains how conic gradients change color around a center, how to control their appearance, and why subtle color choices often work best in a design.

Key terms: conic gradient, radial gradient, conic-gradient(), repeating-conic-gradient(), color stops, hard edge, from <angle>, at <x-position> <y-position>, in <color-space>, contrast

13.2 Shadows

Introduces CSS shadow properties and explains how box-shadow values determine a shadow’s position, shape, softness, and size.

Key terms: box-shadow, text-shadow, horizontal offset, vertical offset, border radius, blur radius, spread radius

13.2.1 Adding depth with gradients and shadows

The section shows how a gradient and box shadows give a button depth and make it appear pressed while active.

Key terms: gradient, box shadow, offset, :active, inset, skeuomorphism, highlights, shadows

13.2.2 Creating elements with a flat design

This section explains flat design’s visual approach and shows how a button can use restrained shadow and color changes while retaining a flat appearance.

Key terms: flat design, skeuomorphic design, gradients, shadows, rounded corners, box shadow, vertical offset, alpha value, hover, active

13.2.3 Creating buttons with a hybrid look

Shows how to give a minimal button a hybrid flat-and-dimensional look using crisp shadows and a pressed-state movement.

Key terms: flat design, skeuomorphism, box-shadow, border radius, active state, transform, translateY(), vertical offset, text-shadow, x-offset

13.3 Blend modes

The section explains how multiple CSS backgrounds layer and how blend modes let opaque backgrounds combine visually.

Key terms: background image, linear gradient, transparent, blend mode, multiply, opaque, background position, background-size, background-repeat

13.3.1 Tinting an image

Shows how to tint a background image with a single hue by blending it with a background color, and why layer order determines the blend mode needed.

Key terms: background-blend-mode, luminosity blend mode, background-color, luminosity, color blend mode, front layer, back layer

13.3.2 Types of blend modes

This subsection explains how CSS blend modes combine pixel colors and groups the modes into five types.

Key terms: blend modes, layers, pixel, composite image, darkening, lightening, contrasting, compositing, comparing, trial and error

13.3.3 Adding texture to an image

Shows how to blend a repeating texture over an image while preserving its color and choosing a contrast blend mode to suit the texture.

Key terms: texture, grayscale image, contrast blend modes, background size, background repeat, cover, tiled, soft-light, hard-light, overlay

13.3.4 Mix blend modes

This subsection explains how mix-blend-mode blends an entire element with content behind it, using a heading over an image as an example.

Key terms: background-blend-mode, mix-blend-mode, hard-light, medium gray, contrast, legibility, low-contrast background image

13.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 12: Typography and spacing Chapter 14: Masks, shapes, and clipping →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.