width: 100% 나 height: 100% 를 주면 누구의 값을 보고 크기가 결정되는 걸까?(부모일까 조부모일까)
https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block
The size and position of an element are often impacted by its containing block. Percentage values that are applied to the width, height, padding, margin, and offset properties of an absolutely positioned element (i.e., which has its position set to absolute or fixed) are computed from the element's containing block.
width, height 등에 붙는 ‘%’ 는 containing block에 의해서 영향을 받기 때문에 어떤 것이 나의 containing block인지 아는 것이 중요함. 그리고 나의 containg block이 무엇인지 결정하는 것은 position 프로퍼티에 의해서 결정된다.
Identifying the containing block The process for identifying the containing block depends entirely on the value of the element's position property:
그래서 div에서 width: 100%를 주었을 때, 어떤 값이 나올지는 containing block이 누군지를 잘 생각해보면 된다.
아래의 예제에서는 flex container 부모의 값을 따라가는 것을 알 수 있음.