格式化与代码
HTML 格式化工具
免费的 HTML 格式化和压缩工具。使用 Prettier 的默认缩进和属性换行风格进行美化,或者将 HTML 折叠成单行用于生产。在浏览器中运行,无需上传。
编辑注
Understanding · Indented HTML, sane defaults.
本深度章节目前仅有英文版本。上方的转换工具支持您的语言;长篇说明文章尚未翻译。
常见问题
Quick answers.
›Which HTML formatter is this?
Prettier's HTML parser with default settings — 2-space indent, 80-column target, attribute per line when the tag overflows. The minifier is a lightweight whitespace collapser that preserves <pre>, <script>, <style> and <textarea> content byte-for-byte.
›Will it break my <pre>, <script>, or <style> blocks?
No — those blocks are protected from whitespace collapse during minification. Their content is extracted, the rest of the document is minified, then the blocks are restored verbatim.
›Does it work on HTML fragments, not just full documents?
Yes. Paste a <div>...</div> or any partial tree; Prettier handles it the same way it handles a full document.
›Is my HTML uploaded?
No — formatting and minification run entirely in your browser. Safe for sensitive markup.
大家也在搜索
相关工具