mc0de
Advanced HTML · Lesson 01 of 13

Text Formatting

Words can do more than fill a page. Learn how to highlight important ideas, add meaning to your content, and make text easier and more enjoyable to read.

HTML Semantic Elements Text Styling Hands-On Practice
● ● ●   formatting.html
<strong>Be bold!</strong>
<em>Be creative.</em>
<mark>Stand out!</mark>
Be bold! Be creative. Stand out!
01 / Getting Started

Why Does Text Formatting Matter?

Imagine reading an article where every word looks exactly the same. No emphasis, no highlights, no indication of what’s important. Pretty boring, right?

HTML formatting helps readers understand your content. Some elements change how text looks, while others tell browsers and assistive technologies what that text means.

Welcome to my blog!
This is important.
This deserves emphasis.
This is worth remembering!
Remember: Great HTML isn’t just about appearance. It’s also about meaning, accessibility, and structure.
02 / The Basics

Make Text Bold, Italic, and Important

HTML gives us several ways to emphasize text. They may look similar, but they don’t always communicate the same meaning.

Try these formatting elements
<p>This is <b>bold text</b>.</p>
<p>This is <strong>important text</strong>.</p>
<p>This is <i>italic text</i>.</p>
<p>This is <em>emphasized text</em>.</p>

This is bold text.

This is important text.

This is italic text.

This is emphasized text.

Use <strong> when something has strong importance, and <em> when you want to stress a word or phrase. The <b> and <i> elements have different semantic uses, such as drawing attention or identifying a technical term.

03 / Headings & Paragraphs

Give Your Content Structure

You’ve already used headings and paragraphs in our HTML & CSS course. Now let’s combine them with semantic formatting to make a more polished article.

A simple article
<article>
  <h2>My Coding Journey</h2>
  <p>Learning HTML is <strong>exciting</strong>!</p>
  <h3>My First Milestone</h3>
  <p>I built my <em>first web page</em>.</p>
</article>
Pro tip: Choose heading levels based on the structure of your document, not just how large you want the text to look.
04 / Highlighting Text

Make Important Words Stand Out

Want to highlight a phrase, show a note in smaller print, or underline an annotation? HTML has elements for those situations.

Highlight and annotate
<p>Remember to <mark>save your work</mark>!</p>
<p><small>Terms and conditions apply.</small></p>
<p>A <u>mispeled</u> word needs attention.</p>

Remember to save your work!

Terms and conditions apply.

A mispeled word needs attention.

The <mark> element marks content relevant to the current context. <small> represents side comments or fine print. <u> represents a non-textual annotation, such as marking a spelling issue.

Good to know: Don’t use <u> simply to make ordinary text look like a link. That can confuse readers.
05 / Editing Content

Show What Changed

Sometimes you want readers to see that content has been added, removed, or corrected. That’s where <del> and <ins> come in.

Before and after
<p>
  The workshop starts at
  <del>2:00 PM</del>
  <ins>3:00 PM</ins>.
</p>
The workshop starts at 2:00 PM 3:00 PM.

This is useful for updates, corrections, document revisions, and showing changes without hiding the original information.

06 / Special Formatting

Superscripts, Subscripts, and Code

HTML can also represent mathematical notation, chemical formulas, keyboard input, and code.

Special text elements
<p>Water: H<sub>2</sub>O</p>
<p>Squared: x<sup>2</sup></p>
<p>Use <code>console.log()</code>.</p>
<p>Press <kbd>Ctrl</kbd> + <kbd>S</kbd>.</p>

Water: H2O

Squared: x2

Use console.log().

Press Ctrl + S.

Bonus: Use <pre> when whitespace and line breaks in preformatted content need to be preserved.
07 / Best Practices

Formatting vs. Meaning

Here’s the secret to writing better HTML: choose an element because it describes your content accurately, not just because it looks nice.

  • Use <strong> for strong importance.
  • Use <em> for stress emphasis.
  • Use <mark> for relevant highlights.
  • Use <del> and <ins> for edits.
  • Use CSS when you only want to change visual styling.
  • Keep headings logical and content accessible.

The result? Cleaner code, more meaningful content, and a better experience for everyone.

🚀 mC0de Challenge

Build a Mini Blog Article

Time to put your new skills to work! Create a mini blog article about something you enjoy — coding, gaming, travel, music, or anything else.

Your Mission

  1. Add a heading and at least two paragraphs.
  2. Use <strong> for an important message.
  3. Use <em> to emphasize a phrase.
  4. Highlight something with <mark>.
  5. Show a correction using <del> and <ins>.
  6. Add one special element such as <sup>, <sub>, or <code>.
Extra challenge: Make your article feel like something you’d actually publish. Use meaningful text, not just placeholder words!
💻 Interactive HTML Sandbox

Try It Yourself!

Your code, your creativity! Edit the HTML, run it, and watch your article come to life in the preview. Experiment as much as you like.

Live Result
Lesson 01 Recap

What You’ve Learned

Look How Far You’ve Come!

You’ve learned that HTML text formatting is about more than making words look different. It’s about giving your content meaning.

  • How to emphasize important text.
  • How to highlight and annotate content.
  • How to represent edits and corrections.
  • How to use special text elements.
  • Why semantic HTML matters.

Next up: HTML Tables — let’s turn rows and columns into beautifully organized information!

Your Learning Journey

0 / 13 Completed

Keep going! Every completed lesson brings you closer to mastering Advanced HTML.

🎉

Nice Work!

You've explored the power of HTML text formatting, learned how to give words meaning, and built your own mini blog article. That's one more skill in your coding toolkit!