Swapnil Mane Profile picture
Dec 5, 2021 β€’ 6 tweets β€’ 4 min read β€’ Read on X
All the Ways to Center a Div in CSS! πŸ‘‡
Thread 🧡

#CSS #Frontend #Javascript Image
βœ… For this, let's consider the following Image which is inside a div tag and the parent element of this div tag is the header tag.

So lets now look at all the ways we can center the div in CSS!πŸ‘‡ ImageImage
1) Traditional Way:

For the parent element,
Set the position to 'relative' and height to '100vh'.

For the child element,
Set top, and left to '50%' and transform to 'translate(-50%,-50%)'

⭐ And Done... Your Child Div is now set to Center! ImageImage
2) Using Flexbox:
βœ… Just add the following properties to the parent element and the child div tag will get centered automatically!

height: 100vh;
display: flex;
justify-content: center;
align-items: center; ImageImage
3) Using CSS Grid
⭐ This is the Shortest and easiest way to center a div tag! ⭐
Just add the following 3 lines to the parent element and the child div tag will get centered automatically!

height: 100vh;
display: grid;
place-items: center center; ImageImage
Great, now you know all the ways to center a div tag.😊
Let me know if you know any other ways to center a div tag down below πŸ‘‡ or let me know if you have any questions!

And if you liked the thread, then consider sharing... It means a lot to me! ❀

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Swapnil Mane

Swapnil Mane 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 @SwapBuilds

Jan 25, 2023
Since yesterday, many developers have reached out to me for tips to get started with freelancing.

Here are 10 threads that can help you get High Paying clients consistently πŸ§΅πŸ‘‡
Read 12 tweets
Dec 16, 2022
I have written 250+ Upwork proposals & received replies to over 100 of them, with about 47 converting to coding jobs.

6 Tips for writing the best proposals and getting your first client on Upwork! πŸ‘‡πŸ§΅
1) Find the name of the client to greet him:

- When sending job proposals, see if you can find out the name of the client in the Client's recent history section.

>> This will help you to start your job proposal by greeting them with their name.

Here: "Hi Karen"
2) Always be Short and Concise!

- You just have 10-20 seconds to capture client’s attention.

>> So, Each sentence in your proposal should be there to define your authority on the subject and nothing else.

Here’s how you can start your proposal πŸ‘‡:
Read 11 tweets
Dec 14, 2022
Python helped me earn more than $20k as a Freelancer!

Become a Job & Freelance ready Python Developer with below roadmap! 🧡
1) Getting started with Basics:

- Print
- Input
- Variables
- Data types
- Strings: slicing, indexing
- Lists, dictionaries, tuples, sets
- Booleans
- Comparison Operators
- Comments
2) Basics 2:

- If, else statements
- For & while loop
- List Comprehensions
- Statements in Python
- Functions and methods
- Map & filter
- Try-except
Read 9 tweets
Nov 30, 2022
React is one of the most Popular Frontend Libraries out there.

Here’s a proper roadmap of topics to master learning React 🧡:
1) Revise JS Fundamentals:

>> Arrow Functions
>> Exports & Imports
>> Destructuring
>> Reference & Primitive types
>> Logical Operators, Methods
>> Async / await

βœ… Make sure to build at least 5 - 10 Javascript projects before moving on to React.
2) Understand React Fundamentals:

>> Applications and uses of React
>> Declarative approach of React
>> Components
>> JSX in React.
>> Sending data to different components via props
>> CSS Styling in React
>> Splitting components.
>> Listening to Events
>> Conditional Rendering
Read 9 tweets
Oct 15, 2022
13 Realistic steps to get started with Freelancing as a Developer:

🧡
1) Go to Two Platforms:

First,
βœ… Upwork

Second,
βœ… Fiverr
2) Search for the skills you want to work as a Freelancer.

eg. "Web Scraping or Data Analytics or React"
Read 19 tweets
Sep 27, 2022
I have got High Paying clients through Upwork, Fiverr, and my Own Website.

5 threads that I wish I had before I started my Freelancing Journey:
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!

:(