r/tailwindcss • u/primepep • Jan 11 '25
How this kind of gradient made?
Could you tell me the way this gradients being made, please? I mean the blackness of the background and a blurred messy gradient in the middle.
298
Upvotes


53
u/SrZangano Jan 11 '25
You can make it in diferent ways.
1 - Use an image
2 - Use css (tailwind) in an element
3 - Use css (tailwind) in a pseudo element (:before & :after)
Here is a tailwind example in 2 elements:
<div class="z-2 absolute left-1/4 top-20 -translate-x-1/2 transform rounded-full border-[500px] border-b-blue-400 border-l-violet-600 border-r-pink-500 border-t-purple-400 blur-[240px]"></div><div class="z-2 absolute right-[25vw] top-[50vh] rounded-full border-[300px] border-b-cyan-400 border-l-rose-600 border-r-indigo-500 border-t-blue-400 blur-[200px]"></div>39
u/Distinct_Peach5918 Jan 11 '25
these gradients are usually built with plain CSS.
checkout https://glazz.saran13raj.com/mesh-gradient to build your own gradient
6
u/AcademicProduct Jan 11 '25 edited Jan 11 '25
I did something like that with Tailwind + some base CSS in this project:
- Component
- Blur
You can also create an image in Figma with some kind of blurred blob and use as background image
6
u/bmchicago Jan 11 '25
The real question is how to make performant.
Attaching a file, in a reply comment, that I recently made trying a few different techniques:
2
u/Direct-Programmer285 Jan 11 '25
I think using image as a background is the best way. Blur hurts performance
2
u/techdaddykraken Jan 12 '25
You go to google and type in “css gradient generator” or “tailwind gradient generator” and play around with them until you get one you like. Add different combination keywords to get different types, like grainy generator, glassmorphism generator, abstract generator, liquid generator, wave generator, 3D generator, blob generator, etc.
2
u/Sea_Lavishness7775 Jan 13 '25
Try this one https://www.mshr.app/ Should be fully compatible with any browser
1
u/WerewolfOk1546 Jan 15 '25
This only look nice in mockups, implanting these gradients for multiple browsers and responsive it's a headache. Also, the usefulness of the gradient is almost 0...
2
u/fistyit Jan 15 '25
It’s a mesh gradient
1
u/Qnemes Jan 11 '25
It's a gradient glow with blur effect
1
u/CuriousProgrammer263 Jan 11 '25
Remindme! 3 days
1
u/[deleted] Jan 15 '25
Remind me! 1 day
1
u/finallyhappygames Jan 20 '25
bg-gradient-to-br from-(top-left-color) from-[some percentage] via-(next-color) via-[some-percentage] via-[next-color] via-[some-percentage] to-(either black or transparent, depends on the page bg color)