CSS box model
The CSS box model represents each element as a rectangular box comprising content, padding, border, and margin areas.
Build a Website with ChatGPT
The CSS layout model in which each element is represented by content, padding, border, and margin regions.
- How it is used
- Structures page elements by controlling their internal spacing, visible edges, and separation from nearby elements.
- How deep it goes
- Defines four regions and demonstrates padding, border, and margin syntax, without developing advanced layout behavior.
- Examples
- Uses header, footer, nav, body, pixel measurements, padding shorthand, and a solid black border.
- What you can do after
- Apply padding, borders, and margins to page elements through CSS declarations or explicit generation prompts.
Read how Build a Website with ChatGPT explains CSS box model →
Web Design Playground, Second Edition
The CSS box model represents an element's dimensions as nested content, padding, border, and margin areas.
- How it is used
- Organizes webpage appearance and positioning by controlling dimensions, whitespace, separation, and element placement.
- How deep it goes
- Defines the four box areas and begins applying width, height, box-sizing, and overflow, without developing full page layout.
- Examples
- Uses a nested-box diagram and a 630px containing div to demonstrate box anatomy and more readable line lengths.
- What you can do after
- Apply CSS dimensions, spacing, borders, and overflow controls to shape element boxes and improve page organization.
Read how Web Design Playground, Second Edition explains CSS box model →
WordPress Power Toolkit: Harness AI to build next-level websites
The CSS box model represents an element as content surrounded by padding, border, and margin areas.
- How it is used
- Uses the box model to inspect and adjust an element’s spacing while experimenting with CSS.
- How deep it goes
- Shows the box-model areas and computed cascade result, but stops short of explaining the full cascade process.
- Examples
- Demonstrates selecting an element, opening Computed, and editing padding, border, and margin values.
- What you can do after
- Diagnose spacing and cascade issues with the Inspector, then test padding, border, and margin changes directly.
Read how WordPress Power Toolkit: Harness AI to build next-level websites explains CSS box model →
CSS in Depth, Second Edition
The CSS box model represents each element as a box composed of content, padding, border, and margin areas.
- How it is used
- Diagnoses unexpected element widths, alignment changes, overflow, and spacing behavior during page layout.
- How deep it goes
- Defines four box areas, calculates default sizing, and notes box-sizing, overflow, margin collapse, and inline-element edge cases.
- Examples
- Uses padded content containers, a page-header h1, and a 300px box with padding and borders to demonstrate rendered dimensions.
- What you can do after
- Diagnose rendered dimensions and choose box-sizing or spacing adjustments for predictable layouts.
Read how CSS in Depth, Second Edition explains CSS box model →
Web Design Playground
A CSS layout model that represents each element as a rectangular box consisting of content, padding, border, and margin.
- How it is used
- Organizes web pages by sizing, spacing, separating, and positioning element boxes.
- How deep it goes
- Defines four box regions and their visual roles, then stops before broader page layout.
- Examples
- Uses a menu list, balanced li padding, and the outline property to make box edges visible.
- What you can do after
- Apply padding, borders, margins, and outlines to control spacing, appearance, and element placement.
Math for Web Design
The CSS box model describes each element as a rectangular box composed of content, padding, border, and margin areas.
- How it is used
- Uses box-model arithmetic to create predictable layouts and troubleshoot sizing problems.
- How deep it goes
- Explains width and height formulas and applies them to fixed boxes and Grid track calculations.
- Examples
- Calculates a 300px box with 20px padding and 10px borders, then distributes remaining space across 2fr and 1fr Grid tracks.
- What you can do after
- Diagnose sizing and Grid-layout discrepancies by accounting for padding, borders, gaps, fixed tracks, and content dimensions.
Related concepts
- paddinghas part · Padding is the addition of extra space, values, or data around or within a structure to satisfy size, alignment, layout, or processing requirements.
- borderhas part · A CSS border is the visual edge surrounding an element’s content and padding areas, defined by properties such as width, style, and color.
- marginhas part · Margin is a borrowing arrangement that allows an investor to purchase securities with funds supplied by a brokerage and secured by those securities.
- box-sizingconfigured by · The CSS box-sizing property determines whether an element’s specified width and height include its padding and border areas.
- content areahas part · The content area is the innermost region of a CSS box containing an element’s text, images, or other rendered content, excluding padding and borders.
- margin propertyhas part · The CSS margin property specifies the outer space around an element’s border, separating it from neighboring content.
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.





