Pratham Profile picture
Apr 7, 2021 16 tweets 7 min read Read on X
Everything you need to know about CSS Flex layout

A Thread🧵
Start appyling display: flex; property to parent element
This will take the all the elements in horizontal direction

{ 2 / 16 }
You can also change the direction of elements. For doing so, you need to mention the "flex-direction" property

The flex-direction property specifies the direction of the items within the flex container

{ 3 / 16 }
After applying row, row-reverse, column and column-reverse in flex-direction

They all are pretty intuitive.

{ 4 / 16 }
If we have a large number of element in flex container, it can destroy the widht of elements

As you can see our elements have shrunk a bit. This is becasue we haven't applied the flex-wrap property.

{ 5 / 16 }
📌 flex-wrap

It defines whether the flex items are forced in a single line or can be flowed into multiple lines depending on screen size. It persist the width of elements

.parent {
flex-wrap: wrap;
}

{ 6 / 16 }
Moving forward, I think this is right time to understand what main and cross axes are👇

We can align elements wihtin Flexbox in accordance with these two axis.

{ 7 / 16 }
Time to align flexible items within flex container

🔹 Justify-content: For horizontal alignment
🔹 Align-content: For vertical alignment

{ 8 / 16 }
The justify-content property aligns the items within flex container.

- flex-start
- flex-end
- center
- space- between (Items will equal space between them)
- space-around (equal space b/w elements with half left side and half right side)
- space-evenly

{ 9 / 16 }
align-content for vertical alignment. For example

{ 10 / 16 }
You can also position a particular item inside flex container.

For this we have, align-self property

For example:

{ 11 / 16 }
You can pass following values in align-self

- auto
- stretch
- center
- flex-start
- flex-end
- baseline
- intial
- inherit

Play with code here: w3schools.com/cssref/playit.…

{ 12 / 16 }
Alright! Moving even further next we have is "order"

If you want to change the ordering of the items within flex container. You can use order property that specifies the order of an item relative to the rest of the items inside the same flex container.

{ 13 / 16 }
📌 flex-grow

The flex-grow property specifies how much the item will grow relative to the rest of the flexible items inside the same container.

{ 14 / 16 }
Similarly we have "flex-shrink" property

The flex-shrink property specifies how the item will shrink relative to the rest of the flexible items inside the same container.

{ 15 / 16 }
I think that's pretty much it for this thread. Did I miss some points? Add below.

Thanks for reading this ❤️

{ 16 / 16 }

• • •

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

Keep Current with Pratham

Pratham 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!

More from @Prathkum

Apr 7
APIs are the backbone of development.

Let me show you how to build your first basic REST API in four simple steps.
Step 1: Install Node.js

I'm assuming you have Node.js installed on your machine. If you haven't installed it, click on the following link and install it simply.

nodejs.org/en
Step 2: Initialize the project

Let's start; create an empty directory and initialize your project by running the following command. Image
Read 17 tweets
Apr 4
5 GitHub repositories will make your life 90% easier:
1. StackQL

StackQL allows you to query multiple cloud and SaaS providers (Google, AWS, Azure, Okta, GitHub, etc.) using SQL.

🔗 github.com/stackql/stackql
Image
2. 50 Projects 50 Days

50+ mini web projects using HTML, CSS & JavaScript.

🔗 github.com/bradtraversy/5…
Image
Read 6 tweets
Feb 2
Convert your Python application into a website in 2 minutes.

Let me show you how:
There's no easy way than this to build a data, AI-based web applications.

I came across Taipy.

It is an open-source Python library for building production-ready front-end & back-end in no time.
Let's see in five simple steps how to build a movie recommendation system using Taipy.
Read 11 tweets
Jan 23
6 free Books to learn web development:
1. The Magic of CSS

The content in this eBook is for all-level developers. Learn about layout, box-model, positioning etc. with sample code snippets.

adamschwartz.co/magic-of-css/
Image
2. DOM Enlightenment

"DOM Enlightenment" is a free online book that explores DOM in-depth, providing a clear and detailed understanding of how it works.

domenlightenment.com
Image
Read 7 tweets
Jan 8
5 GitHub repositories that will make your life 90% easier if you write code:
1. Refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.

Speed up your development timeline.

🔗 github.com/refinedev/refi…
Image
2. Keystone

The most powerful headless CMS for Node.js — built with GraphQL and React

🔗 github.com/keystonejs/key…
Image
Read 6 tweets
Jan 2
6 GitHub repositories will make you feel like an expert developer:
1. BCMS

BCMS is an open-source Headless CMS.

Design your content structure without leaving the browser.

🔗 github.com/bcms/cms
2. llmware

With the help of llmware, you can build your own LLM-based application with little coding and data.

It easily links to all popular models like Hugging Face and OpenAI and automatically captures, tracks, and evaluates AI output results.

🔗 github.com/llmware-ai/llm…
Image
Read 7 tweets

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!

:(