docs.rodeo

MDN Web Docs mirror

CSS box sizing

{{CSSRef}} 

The CSS box sizing module enables developers to specify how elements fit their content or fit into a particular layout context. It defines sizing, minimum sizing, and maximum sizing properties, and also extends the CSS sizing properties with keywords that represent content-based {{glossary("intrinsic size")}}  and context-based extrinsic size.

Elements can either be extrinsically or intrinsically sized. The CSS box model defines page-relative properties to explicitly, or “extrinsically” set an element’s size, including width, height, padding, and margin properties (along with border properties defined in the CSS backgrounds and borders module). This CSS box sizing module extends the CSS box model module to enable an element to be sized intrinsically — setting element size based on the size of its content.

The sizing values introduced in this module allow elements with size containment to take explicit intrinsic sizes, as if their in-flow content’s width and height match the specified explicit intrinsic size, rather than being sized as if they were empty.

This module also introduced the ability to define an aspect ratio for an element’s box, meaning the browser can automatically adjust an element’s dimensions to maintain a specified aspect ratio as long as one of the dimensions is automatically sized.

The logical properties and values module expanded the properties available in the box model and box sizing modules to include writing-mode-relative equivalents of the corresponding physical box model and intrinsic box sizing properties.

Reference

Properties

[!NOTE] The CSS box sizing module introduces the min-intrinsic-sizing property that has not yet been implemented.

Data types and values

[!NOTE] The CSS box sizing module introduces the stretch and contain keywords as sizing values that have not yet been implemented on the box sizing properties.

Functions

Glossary terms

Guides

Specifications

{{Specifications}} 

See also

In this article

View on MDN