Menu

Post image 1
Post image 2
1 / 2
0

CSS Flexbox: The Only Guide You Need

DEV Community·Alex Chen·17 days ago
#fxoK9KqG
#css#beginners#flex#fullscreen#items#enter
Reading 0:00
15s threshold

CSS Flexbox: The Only Guide You Need Stop Googling flexbox every time. Bookmark this page instead. The Container .container { display : flex ; } Enter fullscreen mode Exit fullscreen mode That's it. Everything inside is now a flex item. Direction: Row vs Column /* Horizontal (default) */ .flex-row { flex-direction : row ; } /* Vertical */ .flex-col { flex-direction : column ; } Enter fullscreen mode Exit fullscreen mode Row (default): Column: ┌───┬───┬───┐ ┌───┐ │ 1 │ 2 │ 3 │ │ 1 │ └───┴───┴───┘ ├───┤ │ 2 │ ├───┤ │ 3 │ └───┘ Enter fullscreen mode Exit fullscreen mode Alignment (The Tricky Part) Main Axis vs Cross Axis Row layout: Main axis: → (horizontal) Cross axis: ↓ (vertical) Column layout: Main axis: ↓ (vertical) Cross axis: → (horizontal) Enter fullscreen mode Exit fullscreen mode justify-content (Main Axis) .container { justify-content : flex-start ; /* Default: items at the start */ justify-content : flex-end ; /* Items at the end */ justify-content : center ; /* Items centered */ justify-content :…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More