I’m struggling with CSS Flexbox. Each time I think I’m about to get it in an aha momet, I’m actually two steps backwards. I’m taking The Odin Project course and I’m at the phase where I am building the landing page. I’ve worked on it for 16 straight hours and I’m almost finished. It just looks like shit on a small screen but in fairness, the curriculum did mention that. Otherwise, what I have looks like the goal. I did one or two extra easy touches.
Okay so one question: when is it better to use flex-direction: column and when is it better to use flex-direction row? I’m seriously confused.
Here is an awesome interactive article by Josh W Comeau on flexbox. It has some good examples in there on what you’re talking about too.
In many situations, the default flex-direction: row (elements laid out left to right) is what you want when using flex.
flex-direction: column on the other hand lays elements out from top to bottom. This is basically how elements are laid out anyways—that’s why it’s less common to use this direction. You would typically use this direction on a container that has a larger height than its child elements because now the flex properties can actually position elements within the container and utilize the empty space. Otherwise, most flex properties don’t do anything in this direction.
I think I looked at this one. I’ll probably have to read it again. Thank you for your help. 😄