Skip to content

Courses / HTML5 Mastery: Complete Beginner to Advanced Course / HTML Text Basics

591 people viewed this

HTML Text Basics

The B Element

Use <b> when you want to draw attention to text without implying that it has greater importance, such as a keyword or product name in a passage.

<p>The term <b>HTML</b> stands for HyperText Markup Language.</p>

Remember: Use <strong> for importance and <b> for attention without added importance. Do not choose an element based only on its default appearance.


5. Italics: Emphasis vs Alternative Voice

The <em> and <i> elements are often displayed in italics, but their meanings differ.

The Em Element

Use <em> when you want to emphasize a word or phrase. The emphasis can change how a sentence is understood.

<p>You should <em>always</em> back up important files.</p>

Emphasis can be nested to represent stronger stress emphasis, although it should be used naturally rather than simply to obtain more italic styling.

The I Element

Use <i> for text in an alternate voice or mood, or for terms conventionally distinguished from the surrounding prose, such as a technical term or a word from another language.

<p>The Latin phrase <i lang="la">carpe diem</i> means to seize the day.</p>

<p>The term <i>cache</i> is common in web development.</p>

The lang="la" attribute identifies the language of the Latin phrase.

Quick Comparison

  • <em> — stress emphasis.
  • <i> — alternate voice, mood, or conventionally distinguished text.
  • <strong> — strong importance or urgency.
  • <b> — attention without implying extra importance.

6. Highlighted, Smaller and Superscript or Subscript Text

The Mark Element

Use <mark> for text highlighted because it is relevant in the current context, such as a matching search result.

<p>Search result: Learn <mark>HTML attributes</mark> in this lesson.</p>

Browsers usually render marked text with a highlighted background. CSS can change its appearance.

The Small Element

Rate this course

5.0 · 1 rating

Stars show on this course. Your written note stays private.

Your stars