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 πŸ‘¨β€πŸ’»πŸš€

7 amazing websites that will help you improve your CSS skills

πŸ§΅πŸ‘‡

1️⃣ Learn to code HTML and CSS

- Learn how to build beautiful and intuitive websites by way of clear and organized lessons

πŸ–‡οΈ
https://t.co/bl2rx2q8vk


2️⃣ CSS reference

- CSS Reference is a free visual guide to CSS. It features the most popular properties, and explains them with illustrated and animated content

πŸ–‡οΈ https://t.co/XAlj33g1Zk


3️⃣ CSS tutorial

- These tutorials on web design & CSS makes learning this stuff fun and easy

πŸ–‡οΈ https://t.co/y9vAj6fMGk


4️⃣ CSS Layouts

- This site teaches the CSS fundamentals that are used in any website's layout.

πŸ–‡οΈ https://t.co/n4EGLScpDF
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
65 JavaScript resources that can help you

Mega Thread 🧡 πŸ‘‡πŸ»

πŸ”Ή Websites

1. Java5cript
https://t.co/2gdB6LdfQ8

2. JavaScript Tutorial
https://t.co/YyH7YEZtOL

3. JavaScript 30
https://t.co/X2e6T9qFW5

4. JavaScript Info
https://t.co/GLcMZmyfC9

5. JavaScript by

πŸ”Ή Learn through visualizing

6. JS Visualizer
https://t.co/DKXfCA5bnv

7. UI dev visualizer
https://t.co/IsnNdAGANq

8. JS

πŸ”Ή Documents

9. MDN
https://t.co/XkMlZQOF0h

10. W3 Schools
https://t.co/aJB14ha9KT

11. DevDocs
https://t.co/sVwCCrYKwA

12. JavaScript Info
https://t.co/VJaTfVOIa8

13. JavaScript

πŸ”Ή GitHub repo

14. Modern JavaScript tutorials
https://t.co/vDgTJKbz74

15. Awesome JS Learning
https://t.co/CUCBjfJEcY

16. JS by example
https://t.co/VLT6dRwLSp

17. 33 JS concepts
https://t.co/F5KDOSaACD

18. 30 seconds of

More from Coding

7 best GitHub repositories that can help you as a developer

Thread πŸ§΅πŸ‘‡πŸ»

1️⃣ Awesome For Beginner

- A list of awesome beginners-friendly projects.

πŸ”—
https://t.co/4ycLUOE52j


2️⃣ Awesome Python

- A curated list of awesome Python frameworks, libraries, software and resources.

πŸ”— https://t.co/6B3Ito5wML


3️⃣ 30-seconds-of-code

- Short JavaScript code snippets for all your development needs

πŸ”— https://t.co/zWcmMtg2xa


4️⃣ Dev Portfolio

- A lightweight, customizable single-page personal portfolio website template built with JavaScript and Sass

πŸ”— https://t.co/DR1fiO7TS9

You May Also Like

**Thread on Bravery of Sikhs**
(I am forced to do this due to continuous hounding of Sikh Extremists since yesterday)

Rani Jindan Kaur, wife of Maharaja Ranjit Singh had illegitimate relations with Lal Singh (PM of Ranjit Singh). Along with Lal Singh, she attacked Jammu, burnt - https://t.co/EfjAq59AyI


Hindu villages of Jasrota, caused rebellion in Jammu, attacked Kishtwar.

Ancestors of Raja Ranjit Singh, The Sansi Tribe used to give daughters as concubines to Jahangir.


The Ludhiana Political Agency (Later NW Fronties Prov) was formed by less than 4000 British soldiers who advanced from Delhi and reached Ludhiana, receiving submissions of all sikh chiefs along the way. The submission of the troops of Raja of Lahore (Ranjit Singh) at Ambala.

Dabistan a contemporary book on Sikh History tells us that Guru Hargobind broke Naina devi Idol Same source describes Guru Hargobind serving a eunuch
YarKhan. (ref was proudly shared by a sikh on twitter)
Gobind Singh followed Bahadur Shah to Deccan to fight for him.


In Zafarnama, Guru Gobind Singh states that the reason he was in conflict with the Hill Rajas was that while they were worshiping idols, while he was an idol-breaker.

And idiot Hindus place him along Maharana, Prithviraj and Shivaji as saviours of Dharma.