Monu Tools

จัดรูปแบบ HTML

ปรับปรุง HTML ด้วยการเยื้องที่รู้จัก block หรือย่อ เนื้อหาของ pre, textarea, script และ style ถูกเก็บไว้

วิธีใช้ HTML Formatter

  1. 01

    วาง HTML ของคุณลงในกล่องอินพุต

  2. 02

    เลือก ปรับปรุง เพื่อเยื้องหรือ ย่อ เพื่อบีบอัด

  3. 03

    เลือกขนาดการเยื้อง แล้วคัดลอกผลลัพธ์

What the HTML formatter does

This is an HTML formatter that beautifies markup with block and inline aware indentation, or minifies it by collapsing whitespace and stripping comments. You pick the indent size when beautifying.

Beautifying indents elements according to how they nest, so the structure of a document, which elements contain which, becomes obvious. That makes hand-written or generated HTML far easier to read and debug.

Both beautify and minify run entirely in your browser, so your markup never leaves your device.

Elements it leaves untouched

It deliberately leaves the contents of pre, textarea, script and style untouched, because whitespace inside those elements is significant: reformatting them would change preformatted text, what users type, or the meaning of your code.

How minifying works

Minifying removes comments and collapses runs of whitespace, which trims the file size browsers have to download. It is most useful as a build step for production pages.

Why it keeps a space between tags

The minifier keeps a single space between tags rather than removing it entirely, because whitespace between inline elements is actually rendered, and dropping it can shift your layout. This caution avoids the subtle visual bugs aggressive minifiers can cause.

คำถามที่พบบ่อย

การปรับปรุง HTML ทำอะไร?

เยื้อง elements ตามโครงสร้าง ขณะที่ปล่อยเนื้อหาของ pre, textarea, script และ style ไม่แตะ เนื่องจากช่องว่างมีนัยสำคัญที่นั่น

การย่อ HTML ทำงานอย่างไร?

ลบความคิดเห็นและยุบช่องว่างเป็นช่องว่างเดียว เก็บช่องว่างเดียวระหว่าง tags แทนที่จะลบ เพราะช่องว่างระหว่าง elements inline ถูกแสดงผลและการลบอาจเปลี่ยน layout

HTML ของฉันถูกส่งไปยังเซิร์ฟเวอร์ไหม?

ไม่ ทั้งการปรับปรุงและย่อทำงานทั้งหมดในเบราว์เซอร์ของคุณ ดังนั้น markup ของคุณไม่ออกจากอุปกรณ์

แหล่งข้อมูล

ฝังเครื่องมือนี้

เพิ่มเครื่องมือนี้ลงในเว็บไซต์ของคุณเอง คัดลอกสคริปต์ด้านล่าง โดยจะอัปเดตให้เป็นปัจจุบันโดยอัตโนมัติ

<iframe src="https://monu.tools/embed/th/html-formatter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

เครื่องมือที่เกี่ยวข้อง