this post was submitted on 21 Aug 2023
11 points (92.3% liked)

Web Development

0 readers
1 users here now

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] FlickOfTheBean@lemmy.world 16 points 1 year ago* (last edited 1 year ago) (1 children)

Best to not switch away from the default (row) unless you really know what you're doing. Here's the guide I always consulted for flexbox direction help. I just consulted it until I got the feel for it. I could guess at what you're doing but I think this resource will be better than me hemming and hawing over what you're trying to do: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

So some tips:

  1. column flips what the actual keywords of flex do (justify-content starts to act like align-items and visa versa).
  2. it's easier to develop for small screens and then expand up to large screens. This is because you already know what you'll have to expand from and you won't have to squish anything down. (I'm not saying you should restart your project though, this is a future tip only. Only restart if everything is truly fubar.)

Thank you!!!! This is great!