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
6 beginner friendly websites that will boost your HTML and CSS learning process ๐Ÿš€

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

1๏ธโƒฃ Learn HTML

- The easiest way to learn HTML & CSS. Learn HTML provides an interactive tutorial that explains how to build HTML & CSS websites step by step.

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


2๏ธโƒฃ HTML best practice

- A very well written document on HTML best practice

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


3๏ธโƒฃ Learn to Code HTML & CSS

- Learn to Code HTML & CSS is a simple and comprehensive guide dedicated to helping beginners learn HTML and CSS

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


4๏ธโƒฃ Hex Invaders

- Hex Invaders is a fun way to learn and understand what hex codes are and how they work

๐Ÿ”— https://t.co/EpQyhlN7pv
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
Five great icons websites for every web developer and designer โบ๏ธ

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


1๏ธโƒฃ Icons 8

- Icons8 is just more than icons. You can download illustrations, vector images, music and much more

๐Ÿ–‡๏ธ
https://t.co/inHse0QXBh


2๏ธโƒฃ Icon Monstr

- Black and white themed minimal icons which looks super great. You can also cuatomize the thickness

๐Ÿ–‡๏ธ https://t.co/dbQrJi0IHf


3๏ธโƒฃ Icon Icons

- Over one thousand free icons which you can download as icons or images

๐Ÿ–‡๏ธ https://t.co/h5NlH5fGGr


4๏ธโƒฃ Icons finder

Filter through the worldโ€™s largest marketplace for icons with flexibility and ease. Made up by submissions from top designers around the world, and curated by the team

๐Ÿ–‡๏ธ https://t.co/sqiZ6H9sR7

More from Coding

These 5 visualizers will help you learn data structures and algorithms up to 10 times faster

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

1โƒฃ
https://t.co/H2sKWKEeaz

- Learn DSA and visualize some complex programs. Definitely check it out.


2๏ธโƒฃ https://t.co/0WcFTWBfh9

- Dedicated to graph DS


3๏ธโƒฃ https://t.co/ShEQQkjtWD

- Visualizing data structures and algorithms through animation


4๏ธโƒฃ https://t.co/XxzwBa3vvZ

- All sorting algorithms animations

You May Also Like

Oh my Goodness!!!

I might have a panic attack due to excitement!!

Read this thread to the end...I just had an epiphany and my mind is blown. Actually, more than blown. More like OBLITERATED! This is the thing! This is the thing that will blow the entire thing out of the water!


Has this man been concealing his true identity?

Is this man a supposed 'dead' Seal Team Six soldier?

Witness protection to be kept safe until the right moment when all will be revealed?!

Who ELSE is alive that may have faked their death/gone into witness protection?


Were "golden tickets" inside the envelopes??


Are these "golden tickets" going to lead to their ultimate undoing?

Review crumbs on the board re: 'gold'.


#SEALTeam6 Trump re-tweeted this.
The YouTube algorithm that I helped build in 2011 still recommends the flat earth theory by the *hundreds of millions*. This investigation by @RawStory shows some of the real-life consequences of this badly designed AI.


This spring at SxSW, @SusanWojcicki promised "Wikipedia snippets" on debated videos. But they didn't put them on flat earth videos, and instead @YouTube is promoting merchandising such as "NASA lies - Never Trust a Snake". 2/


A few example of flat earth videos that were promoted by YouTube #today:
https://t.co/TumQiX2tlj 3/

https://t.co/uAORIJ5BYX 4/

https://t.co/yOGZ0pLfHG 5/