What it's for
Style Guide is for a stylesheet that already exists: your own, a client's, or one that came with a theme. It answers three questions:
- What's in it? Every colour, font list and text size, with how often each one is used and where.
- What does it look like? The stylesheet applied to a sample page full of everyday page parts, or to one of your own pages.
- Can everyone read it? Every bit of text on the preview, measured against what's behind it.
You can then change a colour, font or size and watch the page update. Only the values you change are rewritten. Everything else in the file, including its comments and layout, stays exactly as it was written.
To design a new set of colours, use the Colour Palette. To design new buttons or cards, use the CSS Style Lab. Style Guide is for adjusting what's already there.
Quick start
- Open the stylesheet: click Open stylesheet…, drop a
.cssfile onto the page, or paste it on the Stylesheet tab. - Look at the preview on the right. It fills with your styles straight away.
- Adjust on the Colours and Fonts & sizes tabs.
- Check the Readability tab, and fix anything it finds.
- Download the adjusted stylesheet from Download.
Click Try an example to see it work on a sample bakery stylesheet, which has a few readability problems built in.
The preview
Sample page
The sample page has the parts most websites use: a header with a menu, a large heading with buttons, headings from 1 to 6, paragraphs with links, a quote, lists, cards, messages, a table, a form and a footer. It uses common class names such as .btn, .card, .container and .site-header, so many stylesheets style it without any changes.
Anything your stylesheet doesn't style shows the browser's plain default look, like the small grey A plain button. That's useful in itself: it shows what still needs a style.
At the bottom, under Your own classes, each box uses one class name from your stylesheet that the sample page doesn't, so you can see your own pieces too. Some only make sense inside your own layout, so they're left out of the readability check.
My page
To see the stylesheet on one of your real pages, choose My page and paste the page's HTML. In most browsers: open the page, right-click it, choose View Page Source, select everything and copy. You can also open a saved .html file, or drop it onto the page.
- Add the page's web address so its pictures can load. Without it, pictures show as empty boxes.
- The page's own stylesheet links are left out, so the stylesheet you're working on is the one you see.
- Scripts don't run in the preview, so parts that need them, such as a menu that opens or a slider, may look different.
Computer, phone, light and dark
Computer and Phone switch the preview's width. If the stylesheet has a dark version, Light and Dark switch between them. Check both, because colours that work in one often fail in the other.
Show original switches the preview back to the stylesheet without your changes, so you can compare. Click it again to see your changes.
Colours
The Colours tab lists every colour in the stylesheet, most used first. The same colour written different ways, such as #fff, #ffffff and white, counts as one.
Under each colour you see how it's used: how many times, for what (text, background, borders, shadows), and the variable it's set in, if any, such as --brand. Many stylesheets set a colour once in a variable and use the variable everywhere, so the count shows that too: Set in --brand, used 6 times through it. Colours set only for dark mode say so.
To change a colour, click its swatch and pick a new one, or type a new value in the box (any CSS colour works, such as #1f6f5c or rgb(31, 111, 92)). The new colour is written the same way the old one was: a hex colour stays hex, an rgb() stays rgb(), and see-through colours keep their see-through amount.
Click the magnifying glass to see exactly where a colour is used, and the circular arrow to undo a change.
Colours inside comments, quoted text and web addresses aren't touched, and neither are words that only look like colours, such as an animation named red.
Fonts & sizes
Fonts
Each font list is shown with a sample line. A font list names the font to use first, then the ones to use if it's missing, such as Georgia, "Times New Roman", serif. Type a new list to change it everywhere it appears, or choose one of the suggestions.
If the stylesheet loads its own fonts, they're listed at the top. They show on the preview, but the sample lines on the tab use them only if they're installed on your computer.
Text sizes
Every text size, smallest first, with how often it's used and on what. Change a value, such as 2.6rem to 3rem, to update every place that uses it. Sizes written as a calculation or a variable aren't listed, because they depend on other values.
Readability
The Readability tab measures every bit of text on the preview against what's behind it. The measure is contrast: how much lighter or darker the text is than its background, from 1 to 1 (no difference) up to 21 to 1 (black on white).
- Normal text needs at least 4.5 to 1.
- Large text (24 pixels and up, or bold from about 19 pixels) needs at least 3 to 1.
These are the levels most accessibility rules ask for, and they help everyone, for example on a phone in sunshine.
Each problem shows the colours, the contrast, and examples of the text. Where the text colour comes from your stylesheet, you'll see a suggested colour that's close to the original but readable, with a Use it button. Using it changes that colour everywhere, so look over the rest of the page afterwards.
Text on a picture or a colour gradient can't be measured reliably, so it's counted separately for you to check by eye. Hover colours aren't checked either.
The check covers what's on the preview right now. If the stylesheet has a dark version, switch to Dark and check again. If you're using the sample page, check your own page too.
Changes and downloading
The Changes tab lists everything you've changed, with how many places each change affects. Undo one at a time, or all at once.
- Download → Adjusted stylesheet saves the stylesheet with your changes, under its original name.
- Download → List of changes saves a text file listing every change and each place it was made. Handy to send to a client or keep with the project.
- Copy CSS copies the adjusted stylesheet.
The Stylesheet tab always holds your original. Your changes sit on top of it, which is why any of them can be undone. Only edit it there to fix the original itself.
Your stylesheet, page and changes are kept in this browser, so you can close the tab and come back. Clear starts over.
Questions
Why doesn't the sample page look like my site?
Your stylesheet was written for your own pages and class names. The sample page shows how it styles everyday page parts, which is what most of a site is made of. To see your real layout, use My page.
Can it change spacing, corners or shadows?
Not yet. This version covers colours, fonts and text sizes. For other changes, edit the downloaded stylesheet, or try ideas in the Code Sandbox first.
Does it work with large stylesheets, such as Bootstrap?
Yes. A full Bootstrap stylesheet opens in a second or two. Its colour list is long, so the most used colours are at the top.
Does it tidy or check the stylesheet for mistakes?
No. For that, use the CSS Minifier: its Tidy mode lays the stylesheet out neatly and lists problems such as a missing bracket.
Is my stylesheet sent anywhere?
No. Nothing you open or paste leaves this browser. If you give your page's web address, the preview loads that page's pictures from your site, the same as visiting it.