Understanding the Stylesheet You Inherited
By toolbelt maintainers ·
Updated
Compressed CSS is technically CSS, but nobody has ever debugged it on one line. Expanding it is step one.
What is this tool?
A CSS formatter puts each selector and declaration on its own line, so you can see what belongs to what.
How it works
Prettier parses the stylesheet and re-prints it with consistent indentation. Because it parses rather than splits on semicolons, values that contain semicolons — data URIs, for example — survive intact.
Example
Before:
.a{color:red;margin:0}.b{color:blue;padding:8px}
After:
.a {
color: red;
margin: 0;
}
.b {
color: blue;
padding: 8px;
}When to use it
Reading a vendor stylesheet. Finding which rule actually overrides yours. Auditing a third-party widget before you agree to include it.
Optimization Tips
Once it is expanded, search for the property you are fighting rather than the selector. Anything with !important is where your bug lives about 80 percent of the time, and it is easy to miss when the file is one blob.
Frequently Asked Questions
Does it change how the CSS works?
Will it reformat modern syntax?
Why did my data URI get mangled?
Should I commit it formatted?
Related tools
- JSON FormatterBeautify, validate, minify, and view JSON. Format messy API responses into readable code or compress it to save bandwidth, running safely in your browser.
- JSON ValidatorValidate JSON syntax with detailed error messages. Catch trailing commas, missing brackets, and syntax errors instantly before sending payloads to your API.
- JSON MinifierCompress JSON to a single line. Remove all unnecessary whitespace and line breaks to reduce payload size for production APIs without altering the underlying data.
- JSON ViewerView JSON in an interactive, collapsible tree structure. Easily navigate massive API responses, expand specific nodes, and inspect deeply nested objects or arrays.