Text Elements & Formatting Tags
Text is the primary medium for conveying information on the internet. Browsers provide native semantic elements that give written text structure, hierarchy, and meaning for human readers and assistive technology like screen readers.
Headings and Paragraphs
HTML offers six levels of section headings, from <h1> through <h6>. The <h1> tag represents the primary topic of the document and should typically appear only once per page. Subsections use <h2>, and deeper subdivisions use <h3> through <h6>. Never skip heading levels just to alter font size—use CSS for styling.
Paragraphs are created using <p> tags. Browsers automatically insert margin before and after paragraphs to maintain comfortable vertical spacing.
Lists for Organized Information
When grouping related items, HTML provides two primary list types:
- Unordered lists (
<ul>): Use bullet points for items where order does not matter (like ingredients or navigation menus). - Ordered lists (
<ol>): Use numbers for sequential instructions or ranked items.
Each item inside both list types must be wrapped in a list item (<li>) element.
<article>
<h2>Daily Morning Routine</h2>
<p>Follow these <strong>essential</strong> steps every morning:</p>
<ol>
<li>Hydrate with a glass of water.</li>
<li>Review your <em>top three</em> tasks for the day.</li>
<li>Take a ten-minute walk outside.</li>
</ol>
</article>
Adding Emphasis
When certain words need special emphasis, use semantic inline tags:
<strong>: Indicates strong importance or urgency; browsers render this bold by default.<em>: Indicates conversational stress emphasis; browsers render this italicized by default.
Avoid using old non-semantic tags like <b> or <i> when semantic meaning is required.
Key takeaways
- Maintain a logical heading hierarchy from
<h1>down to<h6>. - Wrap normal text passages in paragraph (
<p>) tags. - Choose
<ul>for bulleted lists and<ol>for numbered sequential steps. - Use
<strong>for importance and<em>for stressed words.