Box-sizing
The CSS box-sizing property determines whether an element’s specified width and height include its padding and border areas.
Acing the Frontend Interview
The CSS box-sizing property determines whether an element's declared width and height include padding and borders.
- How it is used
- Supports predictable, maintainable CSS layouts by controlling whether declared element dimensions include padding and borders.
- How deep it goes
- Defines both sizing modes and works through width and height calculations for one element.
- Examples
- Compares a 100px-by-50px element measuring 148px by 81px under `content-box` with its declared size under `border-box`.
- What you can do after
- Operate/configure it in CSS to include padding and borders within an element’s declared dimensions.
CSS in Depth, Second Edition
The CSS box-sizing property determines how an element's declared width and height relate to its content, padding, and border boxes.
- How it is used
- Uses border-box sizing to make padded and bordered layouts align more predictably, including responsive page styling.
- How deep it goes
- Explains content-box versus border-box, demonstrates a heading fix, and recommends a universal rule while warning about legacy styles.
- Examples
- Uses a padded page heading, a 1080px content constraint, a universal selector fix, and a responsive coffee-roaster page.
- What you can do after
- Apply border-box sizing to individual elements or establish it globally in a new stylesheet.
Also covered in
What to know first
- borderA CSS border is the visual edge surrounding an element’s content and padding areas, defined by properties such as width, style, and color.
- paddingPadding is the provision of extra values, characters, bytes, or space around or within data or an element to meet length, boundary, block-size, spacing, or alignment requirements.
- block-level elementA block-level element is an HTML element that participates in block layout, typically starting on a new line and occupying the available width of its container.
- CSSCSS (Cascading Style Sheets) is a stylesheet language for specifying the presentation and layout of structured documents.
Related concepts
- CSS box modelconfigures · The CSS box model describes each element as a rectangular box composed of content, padding, border, and margin areas that determine its dimensions and surrounding space.
- universal selectorconfigured by · The CSS universal selector, represented by an asterisk, matches elements of any type within a document or selected scope.
- reset style sheetconfigured by · A reset style sheet is a CSS stylesheet that removes or normalizes browser-default styling to establish a consistent presentation baseline.
- content areaconfigures · 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.
Questions about box-sizing
What is box-sizing?
The CSS box-sizing property determines whether an element’s specified width and height include its padding and border areas.
Which Manning books explain box-sizing?
Acing the Frontend Interview and CSS in Depth, Second Edition.
What should I know before learning box-sizing?
Manning books that teach box-sizing usually introduce border, padding, block-level element and CSS first.
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.

