Intrinsic vs Extrinsic Sizing
What you'll learn: You'll discover the difference between letting content determine size naturally versus forcing specific dimensions with CSS.
The Core Concept
In CSS, elements can be sized in two fundamental ways:
Intrinsic sizing means the element's size is determined by its content. The browser looks at what's inside (text, images, child elements) and calculates the dimensions automatically. Think of it like a balloon that expands to fit exactly what you put inside it—no more, no less.
Extrinsic sizing means you explicitly set the dimensions using properties like width and height. You're telling the element, "Be exactly this size," regardless of its content. It's like a fixed-size container where the content must adapt to fit.
How They Work
When you don't specify width or height, most elements use intrinsic sizing:
.auto-size {
/* No width/height set - content determines size */
padding: 20px;
}
The element will be as wide and tall as needed to hold its content plus padding.
When you set explicit dimensions, you're using extrinsic sizing:
.fixed-size {
width: 300px;
height: 200px;
}
Now the element is exactly 300×200 pixels, even if the content wants more or less space.
The Trade-offs
Intrinsic sizing is flexible and responsive—it adapts naturally. Extrinsic sizing gives you precise control but can cause overflow or wasted space if content doesn't match your fixed dimensions.
Key Takeaway: Intrinsic sizing lets content control dimensions naturally, while extrinsic sizing uses explicit values to override the content's natural size—each approach has its place in responsive design.