DEV Community

loading...
Cover image for FlexBox Cheat Sheets in 2021 || CSS 2021

FlexBox Cheat Sheets in 2021 || CSS 2021

joyshaheb profile image Joy Shaheb Updated on ・3 min read

Table of Contents --

It's 2021! Let's refresh Our CSS Flexbox Memory. Here's a Cheat Sheet of everything you can do with CSS flexbox to get started in 2021.

FlexBox Architecture

Flex Box model Architecture

FlexBox Chart --

Flex Box property Value Chart

flex-direction

The Direction/Orientation in which flex-items are distributed inside flex-container.

Flex Direction

Flex Direction

justify-content

This property arranges flex-items along the MAIN AXIS inside the flex-container

justify content

justify content

align-content

This property arranges flex-items along the CROSS AXIS inside the flex-container. This is similar to justify-content

align content

align content

align-items

Distributes Flex-items along the Cross Axis

align items

align-self

align self

flex - grow | shrink | wrap

  • flex-grow : grows the size of a flex-item based on width of the flex-container.
  • flex-shrink : The ability for a flex item to shrink based on width of the flex-container. Opposite of flex-grow.
  • flex-wrap : Amount of Flex-item you want in a line/row.

flex grow flex shrink flex wrap

flex wrap flex grow flex shrink

Short Hands

Alt Text

  • flex : It is a shorthand to flex-grow, flex-shrink and flex-basis combined.
  • flex-basis : This is similar to adding width to a flex-item, but only more flexible. flex-basis: 10em; it will set the initial size of a flex-item to 10em. Its final size will be based on available space, flex-grow, and flex-shrink.

flex flex basis

  • flex-flow : Short hand to flex-direction & flex-wrap

Alt Text

Credits

Credits

Read Next :

Conclusion

Here's Your Medal For reading till the end ❤️

Suggestions & Criticisms Are Highly Appreciated ❤️

Alt Text

Alt Text

Discussion (79)

pic
Editor guide
Collapse
chadalen profile image
Chad Alen

This tool is awesome. Makes flexbox easy to understand. I use it alot.
demos.scotch.io/visual-guide-to-cs...

Collapse
joyshaheb profile image
Joy Shaheb Author

A legend made this software, thank you for sharing this 🏅🙏

Collapse
jamesthomson profile image
Collapse
jamesthomson profile image
James Thomson

This is also good for beginners to see how common components can be structured. flexboxpatterns.com/

Thread Thread
ca969 profile image
ca969

Wow, that's a really good resource. Thank you for sharing.

Thread Thread
joyshaheb profile image
Joy Shaheb Author

Most welcome ❤️

Thread Thread
Sloan, the sloth mascot
Comment deleted
Collapse
kyril96340413 profile image
Kyril

Thanks

Collapse
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Collapse
ronaldohoch profile image
Ronaldo Hoch

Niiiice!
Why not this is a PWA?

Collapse
madza profile image
Madza

nice visuals, may I ask what you used? 👀

Collapse
joyshaheb profile image
Joy Shaheb Author

I took Images from Flaticon.com
I gave them credits before conclusion part

Collapse
madza profile image
Madza

Awesome, thanks! 🙏❤

Collapse
bayyash profile image
Bashar Ayyash

Can you please tell me whats the name of icons pack you used? I am a member at Flaticon, I liked the icons you used.

Collapse
rehan124 profile image
Rehan Jamali

Thank you sir... that's cool..but could I download or save it offline?? Bcz I have some Net issues

Collapse
joyshaheb profile image
Collapse
rehan124 profile image
Rehan Jamali

How could I download it offline?

Thread Thread
joyshaheb profile image
Joy Shaheb Author

Click on the image. Then download/save it/ take screenshots

Collapse
qq449245884 profile image
qq449245884

Dear Joy Shaheb, may I translate your article into Chinese?I would like to share it with more developers in China. I will give the original author and original source.

Collapse
joyshaheb profile image
Joy Shaheb Author

Sure. Best of luck ❤️🎖️

Collapse
qq449245884 profile image
qq449245884

Thank You Very Much!

Collapse
kyril96340413 profile image
Kyril

Thank you for sharing this.

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome ❤️

Collapse
jmau111 profile image
Julien Maury

pretty cool!

Collapse
joyshaheb profile image
Joy Shaheb Author

Thank you ❤️

Collapse
mbustosp profile image
Matías Bustos

Really good job! Thank you. It would be amazing if you could do something similar about Grids 😊

Collapse
joyshaheb profile image
Joy Shaheb Author

Thank you for the well wishes. I'll think about Grids in future. Till then, stay tuned ❤️

Collapse
nordyj profile image
Jamie Nordmeyer

Awesome reference. Thanks for this!

Collapse
oliverleitner profile image
Oliver Leitner

ty alot for the heads up. thats going to my pinwall.

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome ❤️

Collapse
hardikchopra242 profile image
Hardik Chopra

Great work 🤩 thank you so much 👍

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome ❤️

Collapse
jamesthomson profile image
James Thomson

I've also found this useful for some of those pesky older browser flex bugs. github.com/philipwalton/flexbugs

Collapse
robinkartikeyakhatri profile image
Robin Kartikeya Khatri

Thank you so much for sharing this wonderful resource.

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome. In future , I'm planning to create a cheat sheet for CSS Grid model as well, Till then , stay tuned & take care ❤️

Collapse
epsi profile image
E.R. Nurwijayadi

Nice cheat.
Nice chat.
Nice cat.

Collapse
joyshaheb profile image
Joy Shaheb Author

This is epic man 🤣🤣
Take medals 🏅🏅

Collapse
realtoughcandy profile image
RealToughCandy.io

Great resource for Flexbox. Nice work.

Collapse
joyshaheb profile image
Joy Shaheb Author

Thank you for the feedback 🏅❤️

Collapse
tiiunder profile image
Felix G

Thanks for that! I love flex box but sometimes I hate it as well. But this cheat sheet gets a nice overview and hopefully reduces by frustration in the future.

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome Felix,
You can follow me along if you're interested to get more contents like these in future.

Collapse
adriathomas profile image
Adrian Thomas

Is there a similar cheat sheet like this but for CSS Grid?

Collapse
joyshaheb profile image
Joy Shaheb Author

Will make it in the future if possible. Till then, stay tuned ❤️🏅

Collapse
crisacosta9 profile image
developing_Dev

Thanks for sharing. This is an awesome resource!

Collapse
surajprasad13 profile image
Suraj Prasad

Nice presentation

Collapse
mvoloskov profile image
Miloslav Voloskov

Nice pics but what about justify-self? What about gap that already works in every new browser except Safari? What about basics like flex-basis?

Perhaps I miss the purpose here.

Collapse
charly2009 profile image
charly2009

nice tutorial

Collapse
redbossrabbit profile image
Ibeh Ubachukwu

Amazing😁

Collapse
sujankh22371674 profile image
Collapse
ryansamaeian profile image
Ryan-samaeian

Sir, You have a talent I have never seen! Tysm :) I know can flex that i know how to use display: flex 😉

Collapse
joyshaheb profile image
Joy Shaheb Author

Thank you soo much for the well wishes. ❤️❤️🏅

Collapse
toqeer__abbas profile image
Collapse
lindaojo profile image
Linda

Well explained!

Collapse
joyshaheb profile image
Joy Shaheb Author

Thank you ❤️

Collapse
alfreddagenais profile image
Alfred Dagenais

Wow, very simple to understand with pictures!! 😍 Finally, I'll get all info easily with flexbox! Thank

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome ❤️

Collapse
abdullaharik profile image
Abdullah Arık

Why we use flexbox or grid? What do you think of this?

Collapse
joyshaheb profile image
Joy Shaheb Author

Both of them are different type of Architecture. & they have the ability to produce the same results. It totally depends on the developer which architecture he/she likes to follow.

Collapse
profkache profile image
Salim Kachemela

Great article. Thanks for sharing.

Collapse
olsha100 profile image
Olsha100

Excellent article!

Collapse
zayidu profile image
Zayidu A

Thanks!

Collapse
joyshaheb profile image
Joy Shaheb Author

Most welcome ❤️