Shubh Sharma {await β˜•} Profile picture
Jun 12, 2023 β€’ 18 tweets β€’ 5 min read β€’ Read on X
This thread will teach you flexbox πŸ§΅πŸ‘‡ Flexbox diagram showing mai...
1/ There are 2 axis in Flexbox πŸ—³

- main axis 🟩
- cross axis πŸŸ₯

I have denoted main axis with green color and cross axis with red color.

Very important lines πŸš¨πŸ‘‡

"main axis is controlled by justify-content property"
"cross axis is controlled by align-items property" flexbox diagram explaining ...
2/ You can also think of main axis as horizontal axis and cross axis as vertical axis however its a wrong approach.

Why ❓

Because this will change when the flex-direction is explicitily set to column.

Note: flex-direction is set to row by default.
3/ When the flex-direction is set to column.

- main axis will become cross axis.
- cross axis will become main axis.

and this is why I said very important 🚨 line because its important to remember which property controls which axis.

You can see here, axis are flipped now πŸ‘‡ Image
4/ But In this thread I will talk only about the different properties when flex-direction is set to "row" by default.

So that everything remains as basic as it can for this thread. 🧡
5/ justify-content: start; Image
6/ justify-content: end;

puts the content at the end of row Image
7/ justify-content: center

puts the content in center Image
8/ justify-content: space-around;

spreads the content Image
9/ justify-content: space-between;

content is spread across the row with equal space but as much as it can take between. Image
10/

justify-content: start;
align-items: center; Image
11/
justify-content: start;
align-items: end; Image
12/

Both of the properties are set to center in this Image
13/

justify-content: space-around;
align-items: center; Image
14/

justify-content: space-around;
align-items: end; Image
15/ 🚨 Do not try to remember these as you will not.

These properties and these layouts can only be learnt when you practice.

I mean how can you remember all of these?

I haven't even mentioned about

πŸ‘‰ row-reverse
πŸ‘‰ column
πŸ‘‰ column-reverse
16/ So what is the best approach to learn these❓

Answer: flexboxfroggy.com
17/ That's a wrap 🎁

In the next thread I will talk about

"what happens when you set flex-direction to row-reverse"

If you liked this thread:

- Retweet πŸ”€
- Leave a β™₯
- Follow me for more of such informative threads.

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Shubh Sharma {await β˜•}

Shubh Sharma {await β˜•} Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(