HTML headings, paragraphs and text formatting give a page its structure. Use <h1> to <h6> for the outline, <p> for blocks of text, and inline elements such as <strong> and <em> for meaning. This tutorial shows each element, when to use it, and which old formatting tags to avoid.
Search engines and screen readers read this structure, so correct markup helps both accessibility and SEO.
HTML has six heading levels. <h1> is the top-level title and <h6> is the lowest. Treat them as an outline, not as a way to make text bigger.
Rules to follow:
<h1> per page, matching the main topic.<h2> followed directly by <h4>.The <p> element holds a paragraph. The browser collapses extra spaces and line breaks in your source, so adding blank lines in the HTML does not add space on the page.
Use <br> only for line breaks that belong to the content, such as an address or a poem. For spacing between blocks, use CSS margins. Use <hr> for a thematic break between topics.
Choose elements by meaning.
| Element | Meaning | Typical rendering |
|---|---|---|
<strong> | Strong importance | Bold |
<em> | Stress emphasis | Italic |
<mark> | Highlighted for reference | Yellow background |
<code> | Computer code | Monospace |
<small> | Side comments, fine print | Smaller text |
<sub> and <sup> | Subscript and superscript | Lowered or raised |
<del> and <ins> | Removed and added text | Strikethrough, underline |
<b> and <i> still exist for text that is styled without extra importance, such as a product name or a technical term, but <strong> and <em> are usually the better choice.
<pre> keeps whitespace and line breaks exactly as written, and nesting <code> inside it marks the content as code.
Several presentational tags were removed from modern HTML. Use CSS instead.
| Obsolete | Use instead |
|---|---|
<center> | text-align: center or flexbox |
<font> | CSS font-family, color, font-size |
<big> | CSS font-size |
<strike> | <del> or <s> |
HTML allows more than one, but best practice is one <h1> that names the page, with <h2> to <h6> below it.
Browsers collapse whitespace. Use CSS for spacing, or <pre> when you need exact whitespace.
<strong> and <b>?<strong> marks importance, and screen readers may stress it. <b> only draws attention without extra importance.
Use headings for a clear outline, paragraphs for text, and semantic inline elements for meaning. Style with CSS and avoid obsolete tags like <center> and <font>.