A complete beginner's guide to CSS Grid layout ๐Ÿ‘‡๐Ÿป

Thread๐Ÿงต

Grid is used for making complex web design layouts more easily as it's not so hard to master

Using Flex you can make only 1D layout but Grid gives you full power of creating 2D layout

Let's start

{ 2 / 21 }
First things first, start with giving the display property "grid" to the container element or parent element

{ 3 / 21 }
Nothing will change after adding display: flex; in the parent container becuase we need to define the width of columns. In order to set that columns width we have gird-template-columns property

{ 4 / 21 }
Let's start with defining the width of our columns.

For example, let's say I need two columns of width 60% and 40% respectively

grid-template-columns: 60% 40%;

{ 5 / 21 }
Ahh!! My grid items looks ugly as there is no spacing between them.
Here "grid-gap" property comes into play. For example I need 10px spacing along column and row

grid-gap: 10px;

{ 6 / 21 }
Similary we have grid-template-rows.

It is used to define the number of rows and height of rows.

grid-template-rows: 200px 400px;

{ 7 / 21 }
As you can see there is a lot of repeated code in
grid-template-columns: 200px 200px 200px 200px 200px;

Instead of this we can use repeat function ๐Ÿ‘‡๐Ÿป

grid-template-columns: repeat(5, 200px);

{ 8 / 21 }
You might run into some responsiveness issues if you pass pixel unit or percentage in your grid-template-columns

In order to prevent this, it is recommended to use fraction values

For example ๐Ÿ‘‡๐Ÿป

{ 9 / 21 }
You can use repeat function for fr as well

repeat(2, 1fr 2fr);

It wil repeat 1fr 2fr two times.

{ 10 / 21 }
Alright moving forward, you can set he height of grid element using grid-auto-rows

For ex, grid-auto-rows: 200px;

{ 11 / 21 }
Though there is a problem. By doing this, we are setting the fixed height so content inside items can be overflow.

For example ๐Ÿ‘‡๐Ÿป

{ 12 / 21 }
In order to prevent this kind of issues we have minmax function

grid-auto-rows: minmax(200px, auto);

It's pretty intuitive that the height of gird items will be 200px minimun and "auto" maximun(according to content)

{ 13 / 21 }
From 14 to 21

https://t.co/QcX5188vjp

More from Pratham ๐Ÿ‘จโ€๐Ÿ’ป๐Ÿš€

If you know CSS then you can use these amazing generators and save your time

Thread ๐Ÿงต๐Ÿ‘‡๐Ÿป

1๏ธโƒฃ CSS Box Shadow Generator

- Generate CSS3 Box Shadow code for your Div, Frame, Buttons or any other HTML element with Outline, and Inset (inner) type shadow effects

๐Ÿ”—
https://t.co/6La36IzBLj


2๏ธโƒฃ Glassmorphism

- Generate glassmorphic design easily

๐Ÿ”— https://t.co/qrKqDV5tzY


3๏ธโƒฃ Cool Backgrounds

- Explore a beautifully curated selection of cool backgrounds that you can add to your next project

๐Ÿ”— https://t.co/df7VSaRSh9


4๏ธโƒฃ Pixel art

- Create CSS pixel art, export the results to CSS and download them.

๐Ÿ”— https://t.co/ojD8qwzuhx
You can learn 90% of CSS using these 10 threads

๐Ÿงต๐Ÿ‘‡

1. All you need to know about CSS


2. Getting started with CSS animations


3. Z-index is tricky but this thread solve all your doubts


4. CSS positioning concepts
9 websites that will help you learn web development faster (they are free) ๐Ÿงต

1. How HTTP Works

Everything you need to know about HTTP based system.

๐Ÿ”—
https://t.co/gVZS4RzS1a


2. 30 Days of Node

Learn Node step by step with interactive examples and code snippet in 30 days.

๐Ÿ”— https://t.co/9nbtMiNB1C


3. How DNS Works

Learn what happens when you type a website address in your browser

๐Ÿ”— https://t.co/SqMRNnDbc3


4. Git

Check out this excellent free website to learn git visually.

๐Ÿ”— https://t.co/rQJMISBDfS
Use these 6 AI websites to finish hours of work in minutes (take a look):

1. Sheet+

Become a spreadsheet master with Sheet+ AI-powered tools.

โ€ข Convert text to formula
โ€ข Convert formula to explanation
โ€ข Debug formulas
โ€ข Generate VBA code
โ€ข Get instant answers to any spreadsheet question

๐Ÿ”—
https://t.co/fWsAeKa6ko


2. DeepCode

DeepCode's AI-based code review notifies you about critical bugs in real time and shows you how to fix them.

๐Ÿ”— https://t.co/dPTPq9syoy


3. Akkio

Grow your business with data-driven decisions.

Go from data to AI in 10 minutes โ€” no code or data science skills required.

๐Ÿ”— https://t.co/I29FIHDIs0


4. Autocode

Instant endpoints for webhooks, bots, and APIs.

Build and host Node.js endpoints in seconds.

Connect to your favorite APIs like Airtable, Discord, Notion, Slack, Webflow, and more.

๐Ÿ”— https://t.co/uQZB0NCHJT

More from Coding

I've brought you some amazing GitHub repositories of web development tips and tricks ๐ŸŒŸ

THREAD๐Ÿงต๐Ÿ”ฝ

1๏ธโƒฃ JS Tips

- A huge list of 73 great tips and tricks of JavaScript

๐Ÿ”—
https://t.co/r0J9vW8WrH


2๏ธโƒฃ CSS Protips

- A collection of tips to help take your CSS skills pro. Definitely check it out

๐Ÿ”— https://t.co/5haB2xTWuz


3๏ธโƒฃ JS Tips and Tricks

- Some advanced tips and tricks of JavaScript that can help you to take your skills onto next level

๐Ÿ”— https://t.co/NvfoANwweV


4๏ธโƒฃ Git Tips

- Git is an essential tool for very programmer. in this repo you'll find the most commonly used git tips and tricks

๐Ÿ”— https://t.co/34qvOhYCZE

You May Also Like

Tip from the Monkey
Pangolins, September 2019 and PLA are the key to this mystery
Stay Tuned!


1. Yang


2. A jacobin capuchin dangling a flagellin pangolin on a javelin while playing a mandolin and strangling a mannequin on a paladin's palanquin, said Saladin
More to come tomorrow!


3. Yigang Tong
https://t.co/CYtqYorhzH
Archived: https://t.co/ncz5ruwE2W


4. YT Interview
Some bats & pangolins carry viruses related with SARS-CoV-2, found in SE Asia and in Yunnan, & the pangolins carrying SARS-CoV-2 related viruses were smuggled from SE Asia, so there is a possibility that SARS-CoV-2 were coming from