why % in css is extrinsic size while other relative units are fixed sized accrording to this talk

52 Views Asked by At

In this talk auto value in CSS is explained in various contexts.Speaker said % is extrinsic unit which make sense because size is dependent on parent. but she also put em, vw, vh, rem and other relative unit's in fixed bucket. size calculation of vh and vw unit's is also dependent on external source(viewport) but why these values are not extrinsic.

1

There are 1 best solutions below

8
Jakub Kotrs On

It's because it is defined like this in CSS specification: https://www.w3.org/TR/css-sizing-3/#extrinsic

  1. Extrinsic Size Determination

Extrinsic sizing determines sizes based on the context of an element, without regard for its contents.

4.1. Percentage Sizing

Percentages specify sizing of a box with respect to the box’s containing block.