liveBook · Manning

Chapter 14: Masks, shapes, and clipping

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

The introduction identifies visual effects the chapter will cover, including hiding parts of elements to make shapes and wrapping text around shaped elements.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction identifies visual effects the chapter will cover, including hiding parts of elements to make shapes and wrapping text around shaped elements.

Key terms: masks, clip paths, floats, shape-outside

14.1 Filters

Introduces CSS filters through blur, showing that a filter affects an entire element and that the blur length controls the strength of the effect.

Key terms: filter property, blur, blur(), length, px

14.1.1 Types of filters

This section describes the available CSS filter functions, how to combine them, and how to use subtle filters to shift attention within an image gallery.

Key terms: filter functions, percentage parameters, filter property, filter, grayscale filter, transition, :hover

14.1.2 Backdrop filter

Explains how backdrop-filter affects content behind an element, with a blur example and a Safari compatibility note.

Key terms: backdrop-filter, filter, blur(), semitransparent, -webkit vendor prefix

14.2 Masks

Introduces image masks as a way to change an element’s visible shape and explains the basic properties and loading conditions needed to use one.

Key terms: masking, mask image, opaque, transparent, mask-image, mask-size, -webkit-mask-image, cover, contain, CORS

14.2.1 Masking with a gradient

Shows how to use a CSS gradient as a mask and how to make an invisible mask easier to debug.

Key terms: mask-image, gradient, transparent, mask-size, background-image, background-size

14.2.2 Masking using luminance

This section explains how to use an image’s brightness instead of its transparency to control a CSS mask, and cautions about browser support.

Key terms: mask-mode, alpha, luminance, -webkit-prefixed

14.2.3 Other mask properties

This section describes the CSS properties that control a mask’s source, placement, extent, interpretation, and combination with other masks.

Key terms: mask, mask-image, mask-size, mask-repeat, mask-position, mask-origin, mask-clip, content-box, padding-box, border-box

14.3 Clipping paths

This section explains how CSS clipping paths hide parts of an element with geometric shapes while leaving its layout space unchanged.

Key terms: clipping path, clip-path, masks, circle(), radius, farthest-side, closest-side, at keyword, border box, ellipse()

14.3.1 Polygon clipping paths

This section explains how polygon() coordinates define a clipping shape and how that shape can frame an image or alter an element’s edges.

Key terms: polygon(), x- and y-coordinate pairs, vertex, visible space, key portion of an image, border

14.3.2 Firefox clip-path tools

This section shows how to use Firefox DevTools to edit clip paths visually instead of repeatedly adjusting CSS values by hand.

Key terms: Firefox DevTools, Rules pane, clip-path, polygon icon, control handle, vertex, radius

14.3.3 Other clip-path types

This section introduces additional clip-path values for rectangular regions and complex SVG shapes.

Key terms: inset(), margin-box, border-box, padding-box, content-box, path(), SVG path string, polygon(), vector-editing software

14.4 Floats and shapes

Introduces how shape-outside changes the way text wraps around an element and why the element must be floated.

Key terms: shape-outside, mask, clip path, inline content, floated, margin box

14.4.1 Floating

Explains how floats make text wrap around an element, how their placement and clearing affect the page, and why text wrapping remains their main use.

Key terms: float: left, float: right, normal document flow, inline content, clear: both, clear: left, clear: right, ::after pseudo-element, floats, flexbox

14.4.2 Defining a shape

Shows how to make text wrap around a floated image’s visible shape, including clipped circles, rounded borders, and gradient masks.

Key terms: shape-outside, clip-path, custom property, border-radius, margin-box, border-box, padding-box, content-box, shape-margin, margin box

14.5 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 13: Gradients, shadows, and blend modes Chapter 15: Transitions →

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.