<!-- HTML Formatter Tool - Copy everything below into your WordPress page (HTML block) --> <h1>HTML Formatter</h1> <!-- Input Section --> <label> Input HTML (or drag and drop an HTML file) </label> 1 <textarea id="htmlf-input" spellcheck="false" placeholder="Enter your HTML code..."></textarea> <!-- Action Buttons --> <button id="htmlf-format-btn" type="button"> Format HTML </button> <button id="htmlf-open-btn" type="button"> Open File </button> <button id="htmlf-clear-btn" type="button"> Clear </button> <button id="htmlf-sample-btn" type="button"> Sample HTML </button> Indent: <select id="htmlf-indent-select"> <option value="2">2 Spaces</option> <option value="4">4 Spaces</option> <option value="8">8 Spaces</option> </select> <!-- Output Section --> <label>Formatted HTML</label> 1 <textarea id="htmlf-output" spellcheck="false" readonly="readonly" placeholder="Formatted HTML will appear here..."></textarea> <!-- Output Actions --> <button id="htmlf-download-btn" disabled="disabled" type="button"> Download HTML </button> <button id="htmlf-copy-btn" disabled="disabled" type="button"> Copy HTML </button> <input id="htmlf-file-input" style="display: none!important;" accept=".html,.htm" type="file" /> <!-- Drop overlay --> Drop HTML file here <style> /* ============================================<br /> HTML Formatter – WordPress-safe scoped styles<br /> All rules scoped under #htmlf-root for high specificity.<br /> ============================================ */<br /> #htmlf-root *,<br /> #htmlf-root *::before,<br /> #htmlf-root *::after {<br /> box-sizing: border-box !important;<br /> margin: 0 !important;<br /> padding: 0 !important;<br /> font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif !important;<br /> line-height: 1.5 !important;<br /> }<br /> #htmlf-root {<br /> position: relative;<br /> width: 100%;<br /> max-width: 940px;<br /> margin: 0 auto;<br /> }<br /> #htmlf-root .htmlf-container {<br /> width: 100% !important;<br /> max-width: 940px !important;<br /> margin: 0 auto !important;<br /> padding: 40px 0 !important;<br /> }<br /> #htmlf-root .htmlf-title {<br /> font-size: 24px !important;<br /> font-weight: 700 !important;<br /> color: #1a1d2e !important;<br /> text-align: center !important;<br /> margin-bottom: 16px !important;<br /> letter-spacing: -0.3px !important;<br /> }<br /> #htmlf-root .htmlf-card {<br /> background: #ffffff !important;<br /> border-radius: 12px !important;<br /> padding: 20px 0 !important;<br /> }<br /> /* Sections */<br /> #htmlf-root .htmlf-section {<br /> margin-bottom: 14px !important;<br /> }<br /> #htmlf-root .htmlf-label {<br /> display: block !important;<br /> font-size: 15px !important;<br /> font-weight: 600 !important;<br /> color: #1a1d2e !important;<br /> margin-bottom: 6px !important;<br /> }<br /> #htmlf-root .htmlf-label-hint {<br /> font-weight: 400 !important;<br /> font-size: 14px !important;<br /> color: #6b7280 !important;<br /> }<br /> /* Editor wrap (line numbers + textarea) */<br /> #htmlf-root .htmlf-editor-wrap {<br /> display: flex !important;<br /> border: 1px solid #e2e5f1 !important;<br /> border-radius: 8px !important;<br /> background: #f9fafb !important;<br /> overflow: hidden !important;<br /> transition: border-color 0.2s ease !important;<br /> }<br /> #htmlf-root .htmlf-editor-wrap:focus-within {<br /> border-color: #4150F6 !important;<br /> box-shadow: 0 0 0 2px rgba(65, 80, 246, 0.12) !important;<br /> }<br /> #htmlf-root .htmlf-line-numbers {<br /> min-width: 38px !important;<br /> padding: 10px 8px !important;<br /> text-align: right !important;<br /> font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace !important;<br /> font-size: 13px !important;<br /> line-height: 1.6 !important;<br /> color: #9ca3af !important;<br /> background: #f3f4f6 !important;<br /> border-right: 1px solid #e2e5f1 !important;<br /> user-select: none !important;<br /> white-space: pre !important;<br /> overflow: hidden !important;<br /> }<br /> #htmlf-root .htmlf-textarea {<br /> flex: 1 !important;<br /> min-height: 130px !important;<br /> padding: 10px 12px !important;<br /> font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace !important;<br /> font-size: 14px !important;<br /> line-height: 1.6 !important;<br /> color: #1a1d2e !important;<br /> background: transparent !important;<br /> border: none !important;<br /> outline: none !important;<br /> resize: none !important;<br /> width: 100% !important;<br /> tab-size: 2 !important;<br /> -moz-tab-size: 2 !important;<br /> }<br /> #htmlf-root .htmlf-textarea::placeholder {<br /> color: #9ca3af !important;<br /> }<br /> /* Action rows */<br /> #htmlf-root .htmlf-actions {<br /> display: flex !important;<br /> flex-wrap: wrap !important;<br /> align-items: center !important;<br /> gap: 8px !important;<br /> margin-bottom: 14px !important;<br /> justify-content: space-between !important;<br /> }<br /> #htmlf-root .htmlf-actions-left {<br /> display: flex !important;<br /> flex-wrap: wrap !important;<br /> gap: 8px !important;<br /> align-items: center !important;<br /> }<br /> #htmlf-root .htmlf-actions-right {<br /> display: flex !important;<br /> align-items: center !important;<br /> gap: 6px !important;<br /> }<br /> /* Buttons */<br /> #htmlf-root .htmlf-btn {<br /> display: inline-flex !important;<br /> align-items: center !important;<br /> gap: 6px !important;<br /> padding: 8px 16px !important;<br /> font-size: 14px !important;<br /> font-weight: 500 !important;<br /> border-radius: 8px !important;<br /> border: none !important;<br /> cursor: pointer !important;<br /> transition: all 0.15s ease !important;<br /> white-space: nowrap !important;<br /> text-decoration: none !important;<br /> line-height: 1.4 !important;<br /> }<br /> #htmlf-root .htmlf-btn:focus-visible {<br /> outline: 2px solid #4150F6 !important;<br /> outline-offset: 2px !important;<br /> }<br /> #htmlf-root .htmlf-btn svg {<br /> flex-shrink: 0 !important;<br /> }<br /> #htmlf-root .htmlf-btn-primary {<br /> background: #4150F6 !important;<br /> color: #ffffff !important;<br /> }<br /> #htmlf-root .htmlf-btn-primary:hover {<br /> background: #3444d9 !important;<br /> }<br /> #htmlf-root .htmlf-btn-primary:active {<br /> background: #2c3ab8 !important;<br /> }<br /> #htmlf-root .htmlf-btn-primary[disabled] {<br /> opacity: 0.4 !important;<br /> cursor: not-allowed !important;<br /> pointer-events: none !important;<br /> }<br /> #htmlf-root .htmlf-btn-danger {<br /> background: #ef4444 !important;<br /> color: #ffffff !important;<br /> }<br /> #htmlf-root .htmlf-btn-danger:hover {<br /> background: #dc2626 !important;<br /> }<br /> #htmlf-root .htmlf-btn-outline {<br /> background: #ffffff !important;<br /> color: #374151 !important;<br /> border: 1px solid #e2e5f1 !important;<br /> }<br /> #htmlf-root .htmlf-btn-outline:hover {<br /> background: #f3f4f6 !important;<br /> }<br /> /* Select */<br /> #htmlf-root .htmlf-indent-label {<br /> font-size: 14px !important;<br /> color: #6b7280 !important;<br /> white-space: nowrap !important;<br /> }<br /> #htmlf-root .htmlf-select {<br /> padding: 7px 10px !important;<br /> font-size: 14px !important;<br /> border: 1px solid #e2e5f1 !important;<br /> border-radius: 8px !important;<br /> background: #ffffff !important;<br /> color: #374151 !important;<br /> outline: none !important;<br /> cursor: pointer !important;<br /> appearance: auto !important;<br /> }<br /> #htmlf-root .htmlf-select:focus {<br /> border-color: #4150F6 !important;<br /> box-shadow: 0 0 0 2px rgba(65, 80, 246, 0.12) !important;<br /> }<br /> /* Drop overlay */<br /> #htmlf-root .htmlf-drop-overlay {<br /> display: none;<br /> position: absolute !important;<br /> inset: 0 !important;<br /> z-index: 50 !important;<br /> background: rgba(65, 80, 246, 0.08) !important;<br /> border: 2px dashed #4150F6 !important;<br /> border-radius: 12px !important;<br /> backdrop-filter: blur(4px) !important;<br /> align-items: center !important;<br /> justify-content: center !important;<br /> }<br /> #htmlf-root .htmlf-drop-overlay.htmlf-active {<br /> display: flex !important;<br /> }<br /> #htmlf-root .htmlf-drop-message {<br /> font-size: 16px !important;<br /> font-weight: 600 !important;<br /> color: #4150F6 !important;<br /> background: #ffffff !important;<br /> padding: 12px 24px !important;<br /> border-radius: 8px !important;<br /> box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;<br /> }<br /> /* Toast notification */<br /> #htmlf-root .htmlf-toast {<br /> position: fixed !important;<br /> bottom: 24px !important;<br /> left: 50% !important;<br /> transform: translateX(-50%) translateY(80px) !important;<br /> background: #1a1d2e !important;<br /> color: #ffffff !important;<br /> padding: 10px 20px !important;<br /> border-radius: 8px !important;<br /> font-size: 14px !important;<br /> font-weight: 500 !important;<br /> z-index: 9999 !important;<br /> opacity: 0 !important;<br /> transition: all 0.3s ease !important;<br /> pointer-events: none !important;<br /> box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;<br /> }<br /> #htmlf-root .htmlf-toast.htmlf-toast-show {<br /> opacity: 1 !important;<br /> transform: translateX(-50%) translateY(0) !important;<br /> }<br /> /* ---- Responsive ---- */<br /> @media screen and (max-width: 640px) {<br /> #htmlf-root .htmlf-card {<br /> padding: 14px !important;<br /> border-radius: 8px !important;<br /> }<br /> #htmlf-root .htmlf-title {<br /> font-size: 20px !important;<br /> }<br /> #htmlf-root .htmlf-actions {<br /> flex-direction: column !important;<br /> align-items: flex-start !important;<br /> }<br /> #htmlf-root .htmlf-actions-right {<br /> width: 100% !important;<br /> }<br /> #htmlf-root .htmlf-btn {<br /> padding: 8px 12px !important;<br /> font-size: 13px !important;<br /> }<br /> #htmlf-root .htmlf-textarea {<br /> min-height: 100px !important;<br /> font-size: 13px !important;<br /> }<br /> }<br /> </style>