jwkoo
jwkoo

Reputation: 2653

why the overflow:hidden creates BFC(Block Formatting Context)?

I learned that the overflow:hidden just handles the context which overflows the box in which it is contained.

BUT why the overflow:hidden creates block formatting context?

What is the relationship between those two? (handling the context which overflows vs creating new block formatting context.)

I`ve already tried to read other articles but i cannot understand "why"

Do I just have to memorize?

desperately need some help..

Upvotes: 1

Views: 470

Answers (1)

Banzay
Banzay

Reputation: 9470

Using the overflow property with a value different to visible (its default) will create a new block formatting context. This is technically necessary — if a float intersected with the scrolling element it would forcibly rewrap the content. The rewrap would happen after each scroll step, leading to a slow scrolling experience.

Upvotes: 1

Related Questions