Monu Tools

منسق HTML

نسق كود HTML بإزاحة تراعي العناصر الكتلية، أو اضغطه. يتم الحفاظ على محتويات pre وtextarea وscript وstyle.

كيفية استخدام منسق HTML

  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؟

يضيف إزاحة للعناصر بناء على تداخلها وبنيتها، مع ترك محتويات pre وtextarea وscript وstyle دون تغيير، لأن المسافات البيضاء فيها ذات أهمية.

كيف يعمل ضغط HTML؟

يزيل التعليقات ويضغط تتابعات المسافات البيضاء إلى مسافة واحدة. ويبقي على مسافات مفردة بين الوسوم بدلا من إزالتها، لأن المسافات بين العناصر السطرية تظهر في العرض وإزالتها قد تغير التخطيط.

هل يُرسل كود HTML الخاص بي إلى خادم؟

لا. يعمل كل من التنسيق والضغط بالكامل داخل متصفحك، لذا لا يغادر الكود جهازك أبدا.

المصادر

ضمّن هذه الأداة

أضف هذه الأداة إلى موقعك الخاص. انسخ المقتطف أدناه، ويبقى محدّثاً تلقائياً.

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

أدوات ذات صلة