RevealTheme logo

CSS格式化与美化工具

为压缩后的CSS添加适当的缩进、换行和间距进行格式化。

如何使用本工具

  1. 1

    Paste your minified or unformatted CSS into the text box.

  2. 2

    Read the formatted result that appears instantly in the output panel below.

  3. 3

    Select the output text and copy it (Ctrl/Cmd+C) into your stylesheet or editor.

  4. 4

    Tweak the input and the output re-formats live as you type.

什么是CSS格式化与美化工具?

压缩后的CSS是去除了所有空白的单行代码。本工具会恢复其可读性:每个属性独占一行,在花括号内缩进,规则之间留一个空行。输出在功能上完全相同,只是更易于阅读或编辑。

常见使用场景

  • Un-minifying a production .css file you pulled from a CDN so you can read what a rule actually does.

  • Cleaning up CSS that was pasted as a single line out of browser DevTools or a build artifact.

  • Tidying inconsistent indentation in a hand-edited stylesheet before committing it to version control.

  • Making a vendor or third-party widget stylesheet legible enough to override specific properties.

  • Preparing a readable CSS snippet to paste into a blog post, tutorial, or Stack Overflow answer.

  • Quickly inspecting the structure of an unfamiliar stylesheet to find where a selector is defined.

常见问题

它会保留注释吗?
块注释(/* ... */)会原样保留在其原始位置。

相关工具