CSS CSS Flexbox Layout Building a Layout with Flexbox Creating a Three Column Layout with Flexbox

Sean Kennedy
Sean Kennedy
2,892 Points

Flex-box order

In the video, the secondary column has its order set to -1 which places it before the primary column as the primary columns order is 0. but when the layout moves to 3 columns why does the tertiary column not also move before the primary column as it also has an order of 0?

2 Answers

blake guyan
blake guyan
8,297 Points

because the primary and tertiary have the same order so they default to their order in the HTML doc.

Robert Leonardi
Robert Leonardi
17,151 Points

initially (let's assume there's the fourth and fifth)

PRIMARY / 0 , SECONDARY / 0 , TERTIARY / 0 , FOURTH / 0 , FIFTH / 0

by making ONLY secondary to -1, it becomes

SECONDARY / -1 , PRIMARY / 0 , TERTIARY / 0 , FOURTH / 0 , FIFTH / 0

anything after secondary (initial state) wasn't affected, coz the order is as what order in the HTML code. if you were to make the fifth to -1, it becomes

SECONDARY / -1 , FIFTH / -1 , PRIMARY / 0 , TERTIARY / 0 , FOURTH / 0

coz the in the HTML order, secondary was written first before the fifth.

Hope it explains