Back to Tools
HTML Formatting Guidelines
Indentation
- Use consistent indentation (2 or 4 spaces)
- Indent child elements relative to parent
- Keep inline elements on same line when appropriate
- Preserve pre-formatted content
Tag Structure
- Use lowercase for tag names
- Quote all attribute values
- Close all tags properly
- Use semantic HTML elements
Best Practices
- Validate HTML before deployment
- Use meaningful class and ID names
- Keep nesting levels reasonable
- Comment complex sections
HTML Element Reference
Semantic Elements
<header>, <nav>, <main>, <section>, <article>, <aside>, <footer>
Text Elements
<h1-h6>, <p>, <span>, <strong>, <em>, <mark>
List Elements
<ul>, <ol>, <li>, <dl>, <dt>, <dd>
Table Elements
<table>, <thead>, <tbody>, <tr>, <th>, <td>