When does the flex-grow switch become flexible and vice versa?

I don’t understand what causes flex items to go from growing to reduce behavior? At first I thought it was a value flex-basis, but what if only one element has it or not?

In addition, the specifications on flex-basissay:

The flex-based CSS property is based on flex, which is the initial base size of the flex element.

What does it mean? If I have one element with it, and the rest by default, why does it usually start a little more than the value? Where is the added space added from?

+4
source share
2 answers

flex-basis flex, .

, ( flex-direction: row) ( flex-direction: column).

, , flex-basis: 100px width: 100px, 100 .

.

THEN . , flex-grow flex-shrink.

100px, flex-grow: 1 , .

100px, flex-grow: 1 , flex-shrink: 1 .

, :

, ?

, (.. flex-grow: 0 flex-shrink: 0), , flex-basis/width/height , .

:

  • flex-basis/width/height , , , . flex-grow .

  • flex-basis/width/height , , , , . flex-shrink .

:

flex-grow

[] flex, , , .

flex-shrink

[] , , , .

flex-basis

[property] flex, .

https://www.w3.org/TR/css-flexbox-1/#flex-property

+4

Flex . , . flex-grow, flex-shrink flex-basis, , .

flex-grow, flex-shrink flex-basis 0 1 auto ( flex: flex: 0 1 auto;). , . ( ).

flex-grow 1 . , . 1 , , . (: W3Schools.com)

1 flex-shrink , . , 0. , , . .

flex-basis auto, , , . W3Schools.com,

. : "", "" , "%", "px", "em" . 1

0

Source: https://habr.com/ru/post/1657278/


All Articles