Basics of CSS Flex Display

Meet Pandya
1 min readJan 8, 2024

--

CSS Flex display was originally released in July 2009.

It is a very powerful & beneficial tool to make great looking web apps but also make developers life easy when it comes to organizing sections in our app or website.

Flex display is built on the idea of a Flex Box. Flex Box is quite self-explanatory i.e its a Box that is Flexible with the items that are inside. The most obvious choice of a box in HTML is a div element.

If you have a div with a bunch of elements inside, flex display can help with aligning them & also which direction they should flow in (row or column) and much more.

Here is the source code that generates the screenshot in this article below

https://github.com/pandyama/Flex-Display

In the below picture we can see 4 basic options with Flex

The Blue box is a div <div> & the boxes inside the div are using para <p>

  • First is Flex display with row
  • Second is Flex with row & justify-content
  • Third is Flex with column
  • Fourth is Flex with column & align-items

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response