Modern CSS Gradients, Shadows and Glass Effects: 10 Recipes You Can Copy

A lot of what makes a website look "modern" in 2026 comes down to three CSS properties: background with gradients, box-shadow, and backdrop-filter. Used well, they add depth and polish without a single image file. Used badly, they make text hard to read and pages feel muddy.
Instead of explaining every slider, this post is a set of practical recipes. Each one starts from a DoraPDF generator, tells you which settings to use, and then shows the small extra CSS that turns the generated code into a finished effect.
The four tools in one minute
- CSS Gradient Generator: linear, radial or conic gradients with two or three colours and an angle from 0 to 360 degrees.
- Box Shadow Generator: horizontal and vertical offset, blur, spread, colour, opacity and an inset option.
- Glassmorphism CSS Generator: blur, transparency, border strength and tint for a frosted-glass card, previewed on a colourful background.
- Mesh Gradient Generator: random soft multi-colour backgrounds as CSS, or as a 1600 × 1000 PNG download.
Every tool shows a live preview and has a Copy button for the CSS.
Gradient recipes
1. A calm hero background
Open the CSS Gradient Generator, keep Linear, choose two colours that are close neighbours on the colour wheel (for example a deep blue and a violet), and set the angle to around 135 degrees. Close colours give a smooth, expensive-looking blend. Very different colours, like red and green, tend to pass through a muddy brown in the middle.
2. Gradient text
Generate any linear gradient, copy it, then add three lines:
.title {
background: linear-gradient(135deg, #ff2e88, #9b3cff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
Use it for one short headline, not for body text. Check that the lightest part of the gradient still has enough contrast with the page background.
3. A pie or progress ring with conic gradients
Switch the type to Conic. With two colours you get a sweep around a centre point. For a hard-edged pie slice, edit the copied code to give each colour a stop, for example conic-gradient(#ff2e88 0 70%, #2a2a2a 70% 100%), which fills 70% of the circle. Add border-radius: 50% to the element and you have a simple chart or progress indicator with no JavaScript.
4. A soft spotlight
Choose Radial with your accent colour first and the page background colour second. The result is a glow that fades into the page. It works well behind a product image or a call-to-action button.
Shadow recipes
5. The natural card shadow
Real shadows are soft and fall downward. In the Box Shadow Generator set Horizontal to 0, Vertical to about 10–20 px, Blur to 30–60 px, Spread to a small negative value like -8 px, and pick black (or a very dark version of your background) with Opacity around 15–25%. The negative spread keeps the shadow tucked under the card instead of spilling out on all sides.
6. Layered shadows for extra depth
The generator creates one shadow at a time, but CSS lets you stack several, separated by commas. Generate a tight shadow (small offset, small blur) and a wide one (large offset, large blur, low opacity), then combine them:
box-shadow: 0 2px 4px rgba(0,0,0,0.12),
0 16px 40px rgba(0,0,0,0.14);
This looks much more realistic than one big blurry shadow.
7. Coloured glow buttons
Set the shadow colour to the button's own colour, offsets to 0 or a few pixels down, blur to 25–40 px and opacity to 40–60%. On dark sites this gives a neon glow; on light sites keep the opacity lower so it does not look smudged.
8. Pressed and inset styles
Tick Inset to put the shadow inside the element. A small inset shadow makes input fields and pressed toggle buttons look recessed into the page.
Glass and mesh recipes
9. A readable glassmorphism card
Glassmorphism needs something colourful behind the glass, otherwise the blur has nothing to show. Start with the Glassmorphism generator's defaults, then:
- Keep Blur between 10 and 20 px. Higher values look foggy and cost more rendering work on low-end phones.
- Keep Transparency low (around 10–20%) for a white tint on a dark background.
- Raise the Border a little: a faint light edge is what makes the card read as glass.
The copied code includes both backdrop-filter and -webkit-backdrop-filter, so Safari is covered. Always test your text on the card. If the background behind it is busy, add a darker tint or more transparency so the text stays legible.
10. Mesh gradient backgrounds
Click Generate in the Mesh Gradient Generator until you like a combination. It picks one of several built-in palettes and places four soft colour spots at random positions. Copy the CSS (a background colour plus stacked radial gradients) for a section background, or click Download PNG to get a 1600 × 1000 image for slides, social posts or a desktop wallpaper. Put a glass card on top and recipe 9 has the background it needs.
Mistakes that make effects look cheap
- Shadows that are too dark. If people notice the shadow before the card, lower the opacity.
- Different light directions. If one element's shadow falls down and another's falls right, the page feels off. Pick one direction for the whole site.
- Gradients on long text. Keep gradient text to headings.
- Glass on a plain background. Without colour behind it, glass just looks like a grey box.
- Ignoring dark mode. Black shadows disappear on dark backgrounds. Use lighter borders, glows or a slightly lighter card colour instead.
Privacy
All four generators run in your browser. No designs, colours or images are uploaded, and the mesh PNG is drawn and saved on your own device. For picking exact brand colours to plug into these tools, the Color Palette Generator works the same way.
FAQ
Is backdrop-filter supported in all browsers?
It works in current versions of the major browsers. Safari has needed the -webkit- prefix, which the generator includes. Older browsers simply show the semi-transparent background without blur.
Can I use more than one box shadow?
Yes. Separate multiple shadows with commas in a single box-shadow property.
Do CSS gradients slow down a website?
Simple gradients are very cheap compared with image files. Heavy blur effects such as large backdrop-filter values are more demanding, so use them on a few elements rather than everywhere.
Can I download a gradient as an image? The Mesh Gradient Generator has a PNG download. The other generators give you CSS code to use directly in your site.
Try the tools from this guide — free
Keep reading
Free CSS Generators: Gradients, Box Shadows, Mesh Gradients and Glassmorphism
Design CSS gradients, box-shadows, mesh gradient backgrounds and frosted-glass cards visually, then copy clean code. Free, no sign-up.
GuideColor Palette Generator: Create Matching Color Schemes and Copy the Hex Codes
Generate five-color palettes with one key press, lock the colors you like, shuffle the rest and copy the hex codes for your brand, website or slides.
GuideHow to Get a HEX Color Code From an Image (Free Online Color Picker)
Click any pixel in a photo, logo or screenshot to get its HEX, RGB and HSL code. Plus an instant palette of the image's main colours. Free, private.