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

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
5 great code snippet websites for every web developer and designer

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


1️⃣ 30 Seconds of Code

- Short code snippets for all your development needs

πŸ”—
https://t.co/91L4bAxkgF


2️⃣ Free Frontend

- Free hand-picked HTML, CSS and JavaScript (jQuery, React, Vue) code examples, tutorials and articles

πŸ”— https://t.co/2sIAm73EdZ


3️⃣ Little Snippets

- A free collection of HTML and CSS code snippets

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


4️⃣ CSS Deck

- Collection of Awesome CSS and JS Creations to help out frontend developers and designers.

πŸ”— https://t.co/LcZYnipvCy
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
Top 5 free APIs for web developers

πŸ§΅πŸ‘‡

1️⃣ Custom Search API

- Create your own custom search engine. You can search for image, videos, and news.

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


2️⃣ Movie Database API

- Access movie and TV information similar to that of IMDB.

πŸ”—

3️⃣ Dad Jokes API

- Get random endless dad jokes

πŸ”—

4️⃣ COVID-19 Data API

- Every 15 minutes updated statistic about Coronavirus. Latest stats by country, are collected from several reliable sources.

πŸ”—

More from Coding

If you are a developer then these GitHub repositories or websites will boost your knowledge to the next level

A Thread 🧡

1️⃣ JavaScript

- A kind of eBook in the form of readme. Covers from beginners to intermediate concepts of JavaScript

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


2️⃣ Python

- A huge list of python projects, snippets, example and almost everything related to Python which helps you understand it in detail

πŸ”—

3️⃣ React Lifecycle

- Interactive React Lifecycle Methods diagram.

πŸ”— https://t.co/7UVoA1rXCZ


4️⃣ Cheatsheets

- JavaScript cheatsheets incluse express4, Node.js, React, MongoDB

πŸ”— https://t.co/Jm9izXrcMu
5 amazing websites that will blow the mind of a developer. Definitely check them out

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

1️⃣ Animation generator

- Dead simple visual tools to help you generate CSS for your projects.

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


2️⃣ Neural Network Visualizer

- Deep playground is an interactive visualization of neural networks, written in TypeScript using d3.js.

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


3️⃣ Blockchain Demo

- A visual demo of blockchain technology

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


4️⃣ Developer Roadmaps

- Step by step guides and paths to learn different tools or technologies

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

You May Also Like

Funny, before the election I recall lefties muttering the caravan must have been a Trump setup because it made the open borders crowd look so bad. Why would the pro-migrant crowd engineer a crisis that played into Trump's hands? THIS is why. THESE are the "optics" they wanted.


This media manipulation effort was inspired by the success of the "kids in cages" freakout, a 100% Stalinist propaganda drive that required people to forget about Obama putting migrant children in cells. It worked, so now they want pics of Trump "gassing children on the border."

There's a heavy air of Pallywood around the whole thing as well. If the Palestinians can stage huge theatrical performances of victimhood with the willing cooperation of Western media, why shouldn't the migrant caravan organizers expect the same?

It's business as usual for Anarchy, Inc. - the worldwide shredding of national sovereignty to increase the power of transnational organizations and left-wing ideology. Many in the media are true believers. Others just cannot resist the narrative of "change" and "social justice."

The product sold by Anarchy, Inc. is victimhood. It always boils down to the same formula: once the existing order can be painted as oppressors and children as their victims, chaos wins and order loses. Look at the lefties shrieking in unison about "Trump gassing children" today.