QuestenaUn entraînement qui indique quoi revoir ensuite
Question 11

An item inside a flex container is given flex: 1. Which set of longhand values does that shorthand set?

  1. flex-grow: 1; flex-shrink: 1; flex-basis: auto
  2. flex-grow: 1; flex-shrink: 0; flex-basis: auto
  3. flex-grow: 1; flex-shrink: 1; flex-basis: 100%
  4. flex-grow: 1; flex-shrink: 1; flex-basis: 0%Bonne réponse

Explication

A single number in the flex shorthand sets flex-grow to that number and fills in flex-shrink: 1 and flex-basis: 0%. The zero basis is the practical point: the item starts from zero size, so the container's whole main-axis space is divided by the grow factors and equal factors give visually equal items regardless of their content. flex: auto is the value that expands to 1 1 auto — it starts from each item's content size and distributes only the leftover space, so items with more content stay wider. Confusing the two is the usual reason 'equal columns' come out unequal.

Continuer avec ce test

Commencer l’entraînement
Question 11: An item inside a flex container is given flex: 1. Which set… · CSS Fundamentals Readiness Check · Questena