What it's for
Getting a button or card to look just right in CSS usually means changing a number, reloading, and changing it again. The CSS Style Lab lets you do it with sliders and colour pickers instead, while you watch. When it looks right, copy the CSS.
Use it for:
- buttons, from plain to pill-shaped, outlined, gradient or "retro" offset
- cards for services, team members or blog posts
- boxes and panels: notices, frosted-glass panels, ribbons, soft raised areas
- hover effects: lifting, growing, glowing, or changing colour.
The CSS it writes is tidy and complete, including the keyboard focus ring for buttons and a gentler version for visitors who've asked their device for less motion.
Quick start
- Choose what you're making: Button, Card or Box.
- Pick a preset from the row at the top, as a starting point.
- Adjust it with the panels on the right: Fill, Shadow, Corners, Border, Text & size, and Hover.
- Check it on different backgrounds, and point at it to see the hover effect.
- Name it and copy. Type a class name, such as
btn-book, then click Copy CSS and Copy HTML.
How the screen works
- Presets run along the top. Click one to load it.
- The preview on the left shows your button, card or box. Under it, the CSS updates as you change things.
- The panels on the right hold the settings. Click a panel's name to open it.
Preview backgrounds
Try the design on Paper, White, Dark, Photo and Checks backgrounds. Photo is useful for see-through and frosted-glass styles. Checks shows exactly which parts are see-through.
Presets
| Preset | What it is |
|---|---|
| Teal pill | A solid, fully rounded button. |
| Outline | A button with just a border, filling with colour on hover. |
| Sunset | A button with a warm gradient. |
| Retro offset | A button with a hard, solid shadow set off to one side. |
| Soft card | A white card with a gentle shadow. |
| Floating card | A card that lifts on hover. |
| Glass | A frosted, see-through card that blurs what's behind it. |
| Soft relief | A box that looks gently pressed out of the page. |
| Dark CTA | A dark box for a call to action. |
| Ribbon | A box with a strong coloured edge, for notices. |
Start over takes you back to the starting style. The design you're working on isn't kept when you close the page, so use Save to my styles for anything you want to keep.
The settings
Fill
- Fill type: a solid colour, a linear gradient (in a straight line) or a radial gradient (from the centre out).
- Gradients: click the gradient bar to add a colour stop, drag stops to move them, and click a stop to change or remove its colour. Set the angle for a linear gradient, or the shape (circle or ellipse) and position for a radial one. Reverse colours flips it.
- Each colour can be partly see-through. Blur behind frosts whatever is behind a see-through fill, for a glass effect.
Shadow
- Quick shadows: None, Subtle, Soft, Lifted, Hard offset, Glow or Inner, with one click.
- Or build your own with Add a shadow layer. Each layer has its across and down position, blur, spread, colour and see-through amount, and can be inside the element (inset). Several soft layers together look more natural than one dark one.
Corners
Quick shapes from Square to Pill, or set the radius yourself. Untick Same for all corners to round each corner differently. Choose pixels or percent: a pill uses a very large radius (999px) so it stays fully round at any size.
Border
Width, style (solid, dashed, dotted or double), colour and see-through amount. Set the width to 0 for no border.
Text & size
- Font: Inter, a serif (Fraunces), the device's own font (System UI), or monospace. Use the one the site already uses.
- Size, weight (regular to bold), letter spacing and colour.
- Inner space: the padding between the text and the edges. For cards and boxes, also the maximum width.
Hover
Tick Add a hover effect, then combine any of these:
- Lift: rises up slightly.
- Grow: gets a little bigger.
- Brightness: lightens or darkens.
- Make the shadow bigger, so it seems to come off the page.
- Hover fill: changes to another colour.
- Speed: how quickly the change happens.
Point at the preview to see it. For visitors who've asked their device for less motion, the copied CSS turns off the lift and grow, but keeps the colour change.
The readability check
For buttons and cards, a badge under the preview shows the text contrast: how easy the text is to read on the fill, such as "Text contrast 6.4 : 1 — easy to read".
- Ordinary text needs at least 4.5 : 1.
- Large or bold text needs at least 3 : 1.
On a gradient, it checks the hardest-to-read part. If it says "hard to read", darken the fill or lighten the text (or the other way round). For see-through fills, the result is an estimate, since it depends on what's behind.
Copying and saving
- Class name: the name the CSS uses, such as
btn-bookorcard-service. Use lowercase and hyphens. - Copy CSS copies the styles. Paste them into the site's stylesheet.
- Copy HTML copies an example of the HTML that uses the class, such as
<a class="btn-book" href="…">. Change the words and link.
For buttons, the CSS includes a clear focus ring for people using the keyboard. Leave it in: without one, keyboard users can't see where they are.
My styles
Save to my styles keeps the design under a name of your choice, so you can come back to it or use it for another client. Saved styles appear with the presets at the top, where you can load them with a click or delete them with their ×. They're kept in this browser on this computer.
Questions
The button looks different on the site.
The site's own CSS may be changing it, such as a font size or link colour set for all links. Make sure the Style Lab CSS comes after the site's other styles, or use a more specific class name.
The frosted glass effect doesn't show.
Blur only shows when there's something behind the box to blur, such as a photo, and the fill is partly see-through. Try it on the Photo background.
Can I use it for things other than buttons and cards?
Yes. "Box" works for almost anything: notices, panels, pricing boxes, image frames. Copy the CSS and use the class on any element.