Pratham Profile picture
May 23, 2021 β€’ 22 tweets β€’ 5 min read β€’ Read on X
Web Layout πŸ–Ό

Structuring your website is essential as it provides better navigation and visualization of the content available on the site. Let's talk a little more about it and learn how we can create a proper layout

πŸ§΅πŸ‘‡πŸ»
Web layout aims for presenting imformation in a logical manner and to make the important elements stand out.

A well designed layout can catch more traffic on your website and make your content easy to understand
πŸ“Œ Design vs Layout?

Web layout is closely related to designing part. But we can say that web designing is much more than the layout only. It covers images, text, color scheme, typography and layout

On the other hand, Layout is all about arrangement of element on the webpage
πŸ“Œ How to make a layout

The oldest way of creating layouts is using HTML <table> tags. Tables are having column and rows so you can make use of it. But this method is out dated as now we have CSS which can handle layout
In CSS, you can create layouts using multi methods. For example positioning concept is also a method of achieving layout but its hard.

Its hard to handle the responsiveness of layout in different screen sizes if we use Position property
We have a better way

Flex and grid CSS layout. The flexible box(flexbox) layout is one dimensional whereas the Grid layout is 2 dimensional
πŸ“Œ Dimensions in CSS layout

You can arrange content on a webpage in row and column wise. More precisely, x axis and y axis. These are the two dimensions of the screen and hence you can arrange element according to these two dimensions
Flex layout only deals with either column or row. It doesn't provide you the flexibility of positioning a element in inconsistent order.

Whereas Grid provides you the flexbility of adjusting element in both the directions either column or row.
CSS grid is the widely used layout methods nowadays. Let's talk about it in details πŸ‘‡πŸ»
gird-template-columns

This property defines the number of column in a grid layout. The values are a space separated list, where each value specifies the size of the respective column.
OUTPUT:
Similary we have grid-template-rows. It is used to define the number of rows and height of rows.

For example:

.container {
gird-template-columns: 200px 200px 200px 200px 200px
grid-template-rows: 200px 400px;
}
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);
Responsiveness is one of the major thing we need to keep in my while forming a proper layout.

There are millions of devices on which your webpage will be viewed. We might run into some responsiveness issue if we use pixel unit.
In order to prevent this issue, it is recommended to use fraction values

For example:

.container {
grid-template-columns: 1fr 2fr 1fr
}
This is the one way of handling responsiveness in width wise

Consider a scenario in which you need to write large amout of text in an element. You will get this issue πŸ‘‡πŸ»
In order to prevent this overflow issue, 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)
So far we have discussed about 1 dimensional layout system. As you can see all element are very consistent and following same number of columns and row. Let's talk something about 2D
The 2 dimensions of CSS grid layout is totally handled by the two CSS properties called grid-row and grid-column
For example:

I want my first item taking up entire row, that is from first column to last column
As you can see the first element covering entire row.
I think that's pretty much it for this thread. Explore more about layouts as it is an essential topic in web development. If you like it, share it with your connections ❀️

Peace out πŸ˜‰

β€’ β€’ β€’

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

Sep 23
5 GitHub repositories will make your life 90% easier as a developer:
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. Open SaaS

Starter kit for your next SaaS.

Tech stack used:

β€’Β React
β€’ Node.js
β€’ Tailwind
β€’Β Stripe
β€’ Plausible

And much more...

github.com/wasp-lang/open…
Image
Read 6 tweets
Apr 30
CORS is the biggest headache for developers.

In the next 3 minutes, you will be able to tackle CORS errors much more effectively.
CORS is not rocket science.

It's the biggest pain for developers because the majority of us don't know its core concept.

Let's try to build a solid fundamental.

Stands for Cross-Origin Resource Sharing.
It is a security feature implemented by web browsers (almost all) that controls how web pages from one domain can request resources hosted on another domain.
Read 9 tweets
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

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!

:(