Mahesh ALN πŸ‘½ Profile picture
Oct 2, 2021 β€’ 29 tweets β€’ 8 min read β€’ Read on X
Are you using solid color background?πŸ™„

Let's upgrade it with beautiful CSS gradients ✨

Mega threadπŸ§΅πŸ‘‡
1️⃣ What is the gradient?

CSS gradient allows you to create anything from a smooth gradient between two colors, right up to impressive mixing and multiple gradients.

Gradient makes the background more attractive than a solid color.
We all know about Instagram but did you notice that the Instagram logo is also a gradient.

The genius is in its simplicity.✨
2️⃣ Types of gradients?

There is three gradient function in CSS.

β—Ό Linear Gradient
β—Ό Radial gradient
β—Ό Conic gradient

Let's talk about each type in more detail.✨
✨ Linear Gradient -

A linear gradient starts at one point and changes along a straight line to the endpoint.

The direction of the linear gradient can be up/down, left/right, or diagonal.

To create a linear gradient you must define at least two-color.
β—Ό Basic linear gradient -

To create the most basic gradient you just need to specify two-color.

Two colors are the minimum required but you can have color as much as you want.

Without specifying angle will consider top-to-bottom.

ExampleπŸ‘‡
β—Ό Changing direction of Gradient -

The values are "to top", "to bottom", "to left", and "to right" used to change direction.

even we're free to use both the horizontal side (left or right), and the vertical side (top or bottom) after "to".

πŸ‘‡
β—Ό Angle for changing direction -

We Are free to use an angle unit to specify the direction of the gradient.

The values are equivalent -

to top - 0deg,
to bottom - 180deg,
to left - 270deg,
to right - 90deg.

you can also use other angle units.
β—Ό Color stop -

One thing we didn't talk about as of now is "color-stop".

Color stops are the colors you want to render smooth transitions among.

A color-stop value, followed by one or two optional stop positions. in percentage or in length.
β—Ό Code Example at one place πŸ‘‡
✨ Radial gradient -

A radial gradient starts from a central point and radiates outwards towards the outer endpoint.
β—Ό Before we move further let's discuss some key terms -

- Size
- Shape
- Position
- color-stop ( Same as linear one )

Let's dive deeper πŸ‘‡
βœ” size -

The size influences the ending shape of the gradient by taking the shape value you determined and instructing the gradient where to end.

⚑ closest-side
⚑ closest-corner
⚑ farthest-side
⚑ farthest-corner ( default one )

Detailed explanation πŸ‘‡
βœ” Shape -

This determines the shape of the gradient, and because we’re talking about radial gradients,

they’re limited to being circular in nature.

Your shapes will be between an ellipse or a circle.
βœ” Position -

This works the same way it does on background-position, So, keywords like β€œtop,” β€œright,” β€œleft,” and β€œcenter” will work here.

You can even use a combination like, β€œtop center.”

1/2
We can also specify an exact position using a numeric value, including the percentage.

Default is center center.

2/2
β—Ό Basic Radial gradient -

To create the most basic gradient you just need to specify two-color.

Two colors are the minimum required but you can have color as much as you want.

All others are default values because we are just specifying colors.
β—Ό shaping of radial gradient -

we already discussed shape and we have 2 values an ellipse or a circle.

Let's see example of both πŸ‘‡
β—Ό Sizing of radial gradients -

we already discussed all the sizing values, let's see one or two values in the example.

for better understanding play with all values.

example πŸ‘‡
β—Ό Changing Position -

We already talked about the positioning of the gradient.

A radial gradient doesn’t have to start at the default center. It can specify a certain point.

example πŸ‘‡
✨Conic gradient -

A conic gradient has a center point in your box and starts from the top and goes around in a 360-degree circle.

The conic-gradient function accepts the position and angle arguments.

By default, the angle is 0 degrees which starts at the top, in the center
Above we already talked about position or angle, so let's see some examples.

πŸ‘‡πŸ‘‡
β—Ό basic conic gradient -

As like linear and radial gradients, all we need to create a conic gradient are two colors.
β—Ό Positioning -
Wait there is still a lot left to share but I think it's enough now 😎

but still, I have some other resources to make gradient creation easy.🀩

Let's check πŸ‘‡
Amazing collection of beautiful gradient combinations by @csaba_kissi πŸ’›.

gradients.colorion.co
Easy gradient generators πŸ‘‡

⚑ gradientgenerator.com

⚑ cssgradient.io

⚑ colordesigner.io/gradient-gener…
I know this thread is huge and it's not easy to remember all the things.🧐

So just hit the bookmark and save it for future reference.😍
And that's it. I tried my best to explain gradients.

If you like this thread, drop a like and retweet, means a lot to me πŸ’›

β€’ β€’ β€’

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

Keep Current with Mahesh ALN πŸ‘½

Mahesh ALN πŸ‘½ 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 @Ali6nX404

Jan 9, 2022
If you don't know "How CSS Works",

because of this sometimes it feels like Black Magic πŸͺ„

That's why I'm constantly creating content to simplify complex CSS topics. 🀞

Here is my top creation of 2022 πŸ‘‡πŸ§΅
2️⃣ min/max width and height

Read 7 tweets
Jan 8, 2022
How Positioning works in CSS 🧐

β—Ό static
β—Ό relative
β—Ό absolute
β—Ό fixed
β—Ό sticky

Thread 🧡
Positioning is one of the core concepts of CSS.

It isn’t as easy as it seems.

I think you must have encountered certain things like navbar or sidebar.

We scroll the webpage but they don't move from their position.
πŸ“Œ What is Positioning?

Positioning in CSS means, to set the position of an element in the webpage.

The property used in positioning is CSS position.
Read 16 tweets
Dec 8, 2021
π˜Ύπ™Žπ™Ž π™Žπ™šπ™‘π™šπ™˜π™©π™€π™§π™¨ 𝙂π™ͺπ™žπ™™π™š βœ…πŸ’™

βœ” Universal Selector
βœ” Class selector
βœ” Type selector
βœ” ID selector
βœ” Attribute selector

Many More...

π“π‘π«πžπšπ 🧡
π™ƒπ™šπ™‘π™‘π™€ π™—π™šπ™–π™ͺπ™©π™žπ™›π™ͺ𝙑 𝙃π™ͺ𝙒𝙖𝙣𝙨 πŸ‘‹

In this thread, we are going to cover basic CSS selectors with code examples.

Let's start πŸš€
πŸ“Œ What is CSS Selector?

CSS selector actually selects the content you want to style.

CSS provides different kinds of selectors to do this.
Read 16 tweets
Dec 5, 2021
I wasted 2 months in tutorial hellπŸ˜–πŸ˜«

But WTF is Tutorial Hell? πŸ€·β€β™€οΈ

How to escape it?πŸ™„

Thread πŸ§΅πŸ‘‡
As I started learning to code, I was stuck in tutorial hell. It felt like, I am learning a lot of the stuff.

I have mastered CSS and JS.
After Creating a lot of projects while watching tutorials.

One day I decided to create a project of my own.
Read 21 tweets
Dec 4, 2021
When you read CSS code and find some weird code like :

-webkit-,
-moz-,
-o-,
-ms-

Let's understand about themβš‘πŸ‘‡
What we're going to cover:-

β—Ό What is the vendor prefix.
β—Ό Prefixes used by major browsers
β—Ό Why we Use?
β—Ό property supported by browsers or not
β—Ό How we can use vendor prefixes?
β—Ό automate the vendor prefix writing
πŸ“Œ What is the vendor prefix?

CSS properties starting with -webkit-, -moz-, -ms- or -o- are called vendor prefixes.

These are the vendor-prefixed offered by the relevant rendering engines.
Read 13 tweets
Dec 3, 2021
Level up your CSS With These Generators and tools✨

threadπŸ§΅πŸ‘‡ Image
1️⃣ This is the best generator to design your next project grid layout visually.

Copy the CSS code directly.
grid.layoutit.com
2️⃣ This Generator allows you to create complex shapes easily.

bennettfeely.com/clippy/
Read 11 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!

:(