liveBook · Manning

Min-height

As explained in Web Design Playground, Second Edition

The CSS min-height property specifies the minimum vertical size of an element's box.

The CSS min-height property sets the smallest vertical size an element's box may have. Setting min-height: 100vh makes the body at least as tall as the browser viewport—like giving the page a floor that cannot drop below the screen. section 15.6

Keep the footer at the bottom

Use min-height: 100vh on a body that stacks its sections vertically. When the page has too little content to fill the screen, the body still reaches the viewport's bottom, allowing the footer to appear there. section 15.6

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    max-width: 50em;
    min-height: 100vh;
}

Inspect a complete body rule combining a vertical Flexbox layout, a maximum width, and min-height: 100vh. section 12.6

How Web Design Playground, Second Edition covers it

How deep it goes
Defines the viewport-height effect and demonstrates it in body rules, without exploring other minimum-height values or edge cases.
Examples
Uses photo-gallery and holy-grail page layouts with body { min-height: 100vh; }.
What you can do after
Apply it via CSS to make a page body fill at least the browser viewport and support bottom-positioned footers.
How it connects
Connects min-height with Flexbox, viewport units, page layout, and footer placement.

Related concepts

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