ปรับปรุง HTML ด้วยการเยื้องที่รู้จัก block หรือย่อ เนื้อหาของ pre, textarea, script และ style ถูกเก็บไว้
วิธีใช้ HTML Formatter
วาง HTML ของคุณลงในกล่องอินพุต
เลือก ปรับปรุง เพื่อเยื้องหรือ ย่อ เพื่อบีบอัด
เลือกขนาดการเยื้อง แล้วคัดลอกผลลัพธ์
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.
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.
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.
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.
คำถามที่พบบ่อย
เยื้อง elements ตามโครงสร้าง ขณะที่ปล่อยเนื้อหาของ pre, textarea, script และ style ไม่แตะ เนื่องจากช่องว่างมีนัยสำคัญที่นั่น
ลบความคิดเห็นและยุบช่องว่างเป็นช่องว่างเดียว เก็บช่องว่างเดียวระหว่าง tags แทนที่จะลบ เพราะช่องว่างระหว่าง elements inline ถูกแสดงผลและการลบอาจเปลี่ยน layout
ไม่ ทั้งการปรับปรุงและย่อทำงานทั้งหมดในเบราว์เซอร์ของคุณ ดังนั้น 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>เครื่องมือที่เกี่ยวข้อง
ปรับปรุงและทำให้ JavaScript สวยงามด้วยการเยื้องและช่องว่างที่สม่ำเสมอ ทำงานทั้งหมดในเบราว์เซอร์ของคุณ
แปลง CSV เป็นไฟล์ Excel .xlsx และ Excel กลับเป็น CSV ทั้งหมดในเบราว์เซอร์ของคุณ ทำงานได้ทั้งสองทิศทาง
สร้าง TypeScript interfaces จากตัวอย่าง JSON พร้อม nested types, arrays และ optional fields ทำงานในเบราว์เซอร์ของคุณ
แปลง JSON เป็น XML และ XML กลับเป็น JSON ในทั้งสองทิศทาง ทั้งหมดในเบราว์เซอร์ของคุณ