liveBook · Manning

Maximum

As explained in Math for Web Design

max() is a CSS function that returns the largest value from its arguments.

Viewport-based text can become too small on a narrow screen. CSS `max()` gives it a floor: it returns the largest of its comma-separated values. In `font-size: max(16px, 4vw)`, the font is at least 16px but can grow as the viewport widens. section 3.2.3

A readable hero heading

Use `font-size: max(32px, 8vw)`. At a viewport width of 320px, `8vw` is 25.6px, so the heading uses 32px. At 500px, `8vw` is 40px, so it uses 40px. The fixed value prevents tiny text; it does not impose an upper limit. section 3.2.3 section 8.2.1

Listing 3.6 Using max() to constrain the minimum font size
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 80px 20px;
}

.hero h1 {
    font-size: max(32px, 8vw);    #1
}

.hero p {
    font-size: max(16px, 4vw);    #2
}

The hero CSS applies the same lower-bound pattern to a heading and a paragraph. section 3.2.3

Choose the constraint that matches the problem: `max()` sets a lower bound, while `min()` sets an upper bound. For both bounds, `clamp(MIN, VAL, MAX)` expresses a preferred value within a range; its constraint pattern can also be written `max(MIN, min(VAL, MAX))`. These functions let sizes change smoothly without relying on a breakpoint for every adjustment. section 3.2.3 section 6.5.6

Keep a floor until text needs to grow

`font-size: max(1.5rem, 2vw)` holds at 1.5rem while that value exceeds `2vw`, then follows the viewport-scaled value. With a 16px root font size, the two values meet at a 1200px viewport: both equal 24px. section 8.4

The same maximum idea appears in JavaScript as `Math.max()`. For example, `Math.max(0.5, Math.random() * maxDepth)` keeps a generated star’s simulated depth from falling below 0.5; that depth then affects its speed, size, and opacity. section 14.2.2

How Math for Web Design covers it

How deep it goes
Defines the largest-value rule and works through viewport-based font sizing; stops short of CSS function implementation internals.
Examples
Uses hero heading and paragraph declarations, a 1200px font-size exercise, and a JavaScript star-depth calculation.
What it assumes
Builds on CSS font-size declarations and viewport units while defining the largest-value rule directly.
What you can do after
Apply it via CSS `max()` to keep responsive text above a chosen minimum.
How it connects
Connects CSS `max()` to viewport units, fluid typography, `min()`, and `clamp()`.

Also explained in

Compare how 4 books explain maximum →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.