格 千格 KiloCell

HTML format complete guide: beautification, insatiable labels and entities

Update 2026-08-08 About 13 minutes development tools How-to

Put HTML on the email template returned from interface, the entire page source exported by CMS, or "page mislabelled but unknown dev" Indentation by Level Often the brackets are more quickly in the compressed string. This guidance describes the differences between beautification and compression, void labels and inconsistent habits, entity and properties, and sets the next thousand local HTML tools.

Use tools immediately HTML Formatting - beautify, compress, attribute break and local statistics
Open tool →

The core sentence.

Let the embedded encoder be visible and then change the class; Compression is left to release, beauty is left to error.

HTML allows for some words such as "browsers can stand and people can't stand": omits the option of closing, no end labels for the void elements, and mixes the entity with the real characters. Formatting tools to draw the hierarchy with indents, and help you find less. </div> Or a layer of extra. It is not a complete HTML certifier and does not replace the DOM standard resolution for the error in the browser. Yes. HTML Format Operate against this guidance.

1. What does beautification and compression mean in HTML

Actions What for? Fit Risk point
Beautify Indent by Label Level, Select Properties Break Read, search unclosed, Code Review Possible changes to the display of "no more than blanks" (see below)
Minify To comment on the redundant space between the label Reduce HTML volume, inline template Mistaken. pre/textarea If it is not achieved properly; To comment on the instructions.
Validate Compare Living Standard/ Template Door-ban The browser may still be "fixed" wrong HTML to make you think it's legal.

Blank sensitivity: (a) Under most block layouts, the break between labels does not affect rendering; But... <pre>、<textarea>Part of the report display:inline scene, spaces in text nodes are part of the content. The logic of this station is to try to be as beautiful as possible. pre/code/script/style/textarea Reduced usage as preforming areas; The compression also protects the internals of the labels before leaving blanks.

Back and forth.

The following is a line of footage:

<div class="card"><h2>Title</h2><p>PositiveMan <strong>Emphasizing</strong></p><img src="/a.png" alt="示Meaning"></div>

After beautification (2 spaces):

<div class="card">
  <h2>
    Title
  </h2>
  <p>
    PositiveMan
    <strong>
      Emphasizing
    </strong>
  </p>
  <img src="/a.png" alt="示Meaning">
</div>

The hierarchy is clear:img As a void element, it is not available in the sky. </img>。 If a deep “silent” level is to be glorified, it is often the lower-integral labels.

2. Labels, entities and attributes: what really should be understood when miscalculated

Void Elements (no closed tags required)

Common void (empty elements) include:area base br col embed hr img input link meta param source track wbr。

  • Written <br>、<br/> or <br /> It is common in the serialization of HTML.
  • don't want Write </br> Or give it to me. img Add </img> When "more regular" -- that's the XHTML brain disability, modern HTML solvers don't depend on it.

This tool is beautiful by identifying the void list and avoiding an erroneous indentation level.

Optional Close and Browser Perception

For example: li、p、td The label can be omitted from the given context. Source code "run" does not mean that the structure is as you think: the browser will automatically fill the nodes, as DevTools saw in the DOM Could not be a byte of the source。 Other Organiser

  1. Format first Source String(interface/file).
  2. Whether or not to rewrite the page with the Elements panel.
  3. Fix bugs with DOM and templates with source documents.

Entity

Writing Meaning When will it be used?
&lt; &gt; < > The text should show the pointer brackets
&amp; & & and Easily Obstructive Text
&quot; &apos; " ' Properties or Body
&nbsp; No line spaces (a) Layout; Do not misuse instead of margin
Digital entity &#8212; Unicode When copying special symbols

Common accidents: (a) Scramble user input as a current HTML untransferable XSS; Or a double-hatting. &amp;lt; Displays the volume of the text. Formatting Won't Automatically transacts with a security change, only sorting blanks and tabs. The shift to the rich text before its entry into the library is a business-level responsibility.

Properties Line Breaks & & Quotes

Tools provide "Replacement break": multiple properties can be used to indent each attribute in the next row and allow for review class、data-*Long srcset。 Properties may be standardized in the form of double quotation marks during a beautification process - confirmation before writing back does not conflict with the template engine quote rules (e.g., some engines are already double quotes).

script / style Inner association

Inline JS/CSS is safer to process in preform blocks when it's beautified, and avoids </script> String break. Depth format JS/CSS please use Script Tool and CSS Format。

3. Gradual description using KiloCell

tools page:HTML Format。

  1. Open the page. Enter /tools/dev/html-formatter。 Toolbars can be found: Indent type (space/Tab), indent size (default 2), Properties Breaking, "Blank Rows " .
  2. Paste HTML. The left side of the "Input HTML Code" You can also read "paint" from the clipboard (require browser privileges).
  3. bar.
  • Consistent with repository: Space + 2 or 4.
  • Long Properties: Check out the Properties Break.
  • A sense of paragraph needs to be maintained: "Reserve empty lines" (default tick).
  1. Beautify。 The blog is a bit of a "Beautify Code" (Beauty). Success; Right output indentation. Enter the option to change the logic and ultimately confirm the output by clicking on the beautification/compression.
  2. The government has been trying to find out whether the indentation is "not going back." If a section continues to be deeper than the surrounding area, look up for unclosed labels.
  3. Minify。 One-key compression (Miniffy) removes the gap between comments and labels in the safe range and protects pre/script/style/textarea Internal; The statistical area displays the input/output characters and compression rate.
  4. Copy。 The results are copied and the output is taken away.
  5. Clear。 Clears the editing status of the input output and the local cache (if the page allows for the state protracted).

Capacity boundaries

  • Support: beautification indents, void recognition, property line breaks, retention of blank line options, compression and character statistics, theme.
  • Do not declare: Complete HTML5 verification, auto-recovering of all missing documents, by-the-syll, execution or purification of scripts (no DOM XSS protection package) with Prettier plugins.
  • Local: Processing completed in browser; User privacy in mail, unpublished active page source code, still keep your desktop shared.

When a "pressure-only" fixed entrance is required, it is available. HTML Minify。 Generate HTML from Markdown Markdown Turn HTML or format after preview.

4. Common errors and treatments

phenomena Common causes What do we do?
It's getting deeper and deeper. Missing closed tab From the deepest anomalies. </…>
A certain part of the beautiful suddenly returns to 0 indent Overwrited closed labels Delete Extra </div> Wait.
Compressed pre The code is out of order. The protection logic is not covered or broken by hand Compressing with tools rather than removing spaces by hand; Check Tab Name
There are huge gaps in the pages. Interconnectional line breaks are used as spaces by CSS (a) Structural adjustment or CSS; Inline scenes when beautiful
& Causes subsequent properties to disappear Attribute value not written &amp; or without quotation marks Supplementary quotation marks and entities
Chinese Spell Source file code not consistent with statement UTF-8 harmonization; Inspection <meta charset>
Non-standard labels for component frameworks MyWidget Wait. (a) Tools are processed by common labels; Use frame documents as the basis
Not in line with browser DOM Browser Auto Completion Run the truth with DOM, code by template
Compression rate 0% Compressed HTML or very short Normal; Re-optimization requires structural and resource changes
The template blew up after the crossover of the ticking attribute. Service-end template sensitive blanks (b) For static segments only; Back to caution.

Suggested order of reference

  1. Is it a source or a CSS problem (but can hide the sylesheet comparison first).
  2. Formats the source code to see if the label is closed.
  3. Compare DevTools Dom.
  4. Check if the entity code and script changes innerHTML.

5. Real work landscape

Scenario A: Activity page "Flows the right column to the bottom"

The product screenshot shows the layout crashing. Get the template HTML beautification, find one section Keep it closed. Back there. aside Eat into the main column. Adding a label does not require doubting Grid's error.

scene B: Mail HTML pre-delivery check

Mail HTML is often pressed by the generator into a row. Check for misuse after beautification <script>, too big base64, unreconciled user nicknames. Compress back the delivery version. Note that the mail CSS supports the alternative.

C:CMS "View-edited" source code

Multiple saves make no sense span and &nbsp;。 Delete empty span, put &nbsp; Replaces the style spacing. Press again to see volume before submitting.

scene D: Markdown transferred HTML to the site shell

Use Markdown Turn HTML or the previewer copys HTML, and you insert the indentation of the tool and then embed the layout component. If the source is MD, the MD should be maintained for the long term, not just the generator.

Scene E: Security Audit Checks "Is the user plugged in the attribute?"

Search after beautification onclick=, properties without quotation marks,javascript:。 Formatting increases the speed of audits and does not replace professional scanning.

F: Making a "class" with CSS

List of Class after HTML beautification, CSS side CSS Format # Search after. Spelling btn-primary vs btn_primary It's a high frequency problem.

6. Inventory of collaboration and quality

  • Repository Unified Indent (space 2/4) and Allow Tab
  • (a) Default conversion of user data in the template; Free Text White List
  • Pictures must have meaning. alt(Ecoholic drawings are empty att, but intentionally)
  • Confirm before compression pre/Inline scripts do not depend on "deleted" external blanks
  • Do not overwrite the product without reviewing the glorification of the megastatic page
  • (a) Maintaining a streamlined HTML critical path; The rest of the components
  • Statement <!DOCTYPE html> and lang# charset, reduce the weird mode #

FAQ

Can formatting automatically fix all unclosed labels?

I can't "guess" you for what you're meant to do. It exposes problems mainly through indentation; Auto-fill is a function of the browser or HTML fixer and may be filled in a misdeed position. Make it manual, depending on your product structure.

Why is there a slight difference in vision after aestheticization?

The break between inline elements may become a blank node. View text nodes with DevTools during comparison; Write the labels immediately or use Flex to remove the blank impact, as necessary.

XHTML type <br/ > . Do you want more?

HTML active standard void element writing <br> - Yeah. If Tool Output Belt /, the general browser is still accepted. XML Embedded scenes follow XML rules.

Will compression remove the condition note?

It'll be the end of the ordinary. <!-- -->, and try to avoid the IE condition comment mode; Old mail/IE needs should be tested separately, without assuming 100 per cent retention.

Can you upload the entire station, index, online?

It may be temporary, but the construction (including testing) should be included in the project. Online tools are suitable for clips and emergencies and are not the only production line.

Which of the entity and Unicode characters is better?

Visible text preference for direct UTF-8 characters; In HTML Syntax sensitive places (e. g. quotes in attributes, text) <) uses the entity or ensures conversion. The two are used in a way that is "non-destructive, readable".

Do tools execute my paste script?

Beautification/ Compression to Text Process Output to Texttarea, not to execute your HTML as the current page DOM. But beware of XSS - the viewer HTML must be disinfected when copying HTML to another rich text or preview environment.

Continue reading

Paste a little part of it img、div Embedded source code, pitiful "replacement line" and deliberately delete one. </div> See the indentation changes. Move to Markdown tool when MD workflow is required.