HTML
I. HTML Fundamentals
1. Introduction to HTML
2. How the Web Works
3. HTML Document Structure
4. HTML Elements and Tags
5. HTML Attributes
6. Text Formatting Tags
7. Headings and Paragraphs
8. Comments and Whitespace
II. Core HTML Elements
9. Links and Navigation
10. Images and Media
11. Lists in HTML
12. Tables in HTML
13. Forms Overview
14. Input Types
15. Form Validation Basics
16. Buttons and Actions
III. Advanced HTML & Semantics
17. Semantic HTML
18. Layout Elements
19. Audio and Video
20. Iframes and Embeds
21. Meta Tags and SEO
22. Accessibility Basics
23. ARIA Attributes
24. Responsive HTML
IV. Best Practices & Projects
25. HTML Best Practices
26. Clean and Readable HTML
27. HTML Performance Tips
28. HTML Security Basics
29. Browser Compatibility
30. Debugging HTML
31. Mini Project – Portfolio Page
32. Mini Project – Landing Page
33. Mini Project – Form Page
34. Mini Project – Blog Layout
35. HTML Interview Questions
36. HTML Real-World Use Cases
37. HTML Case Study
38. HTML Project Planning
39. HTML Final Project
40. HTML Course Wrap-Up
LESSON 6
Text Formatting Tags
Make text bold, italic, underlined and highlighted using HTML formatting tags that change how words appear on screen.
Think about Microsoft Word or Google Docs. You select some text and click a button to make it bold. HTML works the same way, but instead of clicking buttons, you wrap text with special tags that tell the browser how to display it. Alex wants to add some formatted text to their portfolio — making important words stand out and adding emphasis where needed. Before we jump into code, let's understand how these tags work.How Text Formatting Tags Work
A text formatting tag is like a highlighter or pen that changes how text looks. You wrap the text you want to change between an opening tag and a closing tag. The browser sees these tags and applies the formatting.<strong>
This text is important
</strong>
Opening Tag
Content
Closing Tag
Bold Text Tags
HTML gives you two ways to make text bold. They look the same but mean different things to screen readers and search engines.The Strong Tag
The<strong> tag makes text bold AND tells screen readers that this text is important. Use it for content that really matters — like warnings, key points, or critical information.
<!-- Alex highlighting important skills on their portfolio -->
<p>I specialize in <strong>JavaScript</strong> and <strong>React development</strong>.</p>
<p><strong>Warning:</strong> This project is still under development.</p>localhost/index.html
What just happened?
The browser made "JavaScript", "React development", and "Warning:" appear bold. Screen readers will emphasize these words when reading aloud. Try this: add strong tags around your name or main skills.
The Bold Tag
The<b> tag makes text bold for visual style only. It doesn't tell screen readers that the text is important. Use it when you want bold text for design reasons — like styling a company name or making text stand out visually.
<!-- Alex styling text for visual design -->
<p>Built with <b>HTML</b>, <b>CSS</b>, and <b>JavaScript</b></p>
<p>Welcome to <b>Alex Portfolio Studio</b></p>localhost/index.html
Most developers prefer
<strong> over <b> because it's better for accessibility. Screen readers can understand what's actually important versus what's just styled.Italic Text Tags
Just like bold text, HTML gives you two ways to make text italic. One adds meaning, the other adds style.The Emphasis Tag
The<em> tag makes text italic AND adds emphasis. Screen readers will change their tone when reading emphasized text. Use it when you want to stress or highlight something important.
<!-- Alex adding emphasis to important points -->
<p>I <em>love</em> creating beautiful user interfaces.</p>
<p>This project took <em>three months</em> to complete.</p>
<p>Please <em>do not</em> use this code in production yet.</p>localhost/index.html
The Italic Tag
The<i> tag makes text italic for style purposes. Use it for things like book titles, foreign words, or technical terms that are traditionally displayed in italics.
<!-- Alex using italics for proper formatting -->
<p>My favorite book is <i>The Design of Everyday Things</i>.</p>
<p>I learned to say <i>bonjour</i> while working in France.</p>
<p>This website uses the <i>flexbox</i> layout method.</p>localhost/index.html
What just happened?
The browser displayed all the text in italics, but the meaning is different. The em tags add vocal emphasis while the i tags follow traditional formatting rules. Try this: use em for emotions and i for titles.
Underline and Strike-Through
HTML includes tags for underlining text and crossing it out. These tags are less common but useful in specific situations.Underlined Text
The<u> tag underlines text. Be careful with this one — users expect underlined text to be clickable links. Only use it when you really need underlined text that isn't a link.
<!-- Alex using underline for specific formatting -->
<p>Fill in the blank: My name is <u>Alex Johnson</u>.</p>
<p>Misspelled words appear <u>underlined</u> in most text editors.</p>localhost/index.html
Strike-Through Text
The<s> tag puts a line through text, showing that it's been removed or is no longer accurate. Think of it like crossing something off a to-do list.
<!-- Alex showing old vs new information -->
<p>Project deadline: <s>December 15th</s> December 20th</p>
<p>Price: <s>$299</s> $199 (Limited time!)</p>
<p>Status: <s>In Progress</s> Completed</p>localhost/index.html
Watch out!
Don't use underline tags for emphasis or style. Users will try to click them thinking they're links. Use
strong or em instead.Highlight and Small Text
HTML includes a few more formatting tags for specific situations — highlighting important text and displaying fine print.Highlighted Text
The<mark> tag highlights text with a yellow background, like using a highlighter pen on paper. Perfect for search results, important notes, or drawing attention to key information.
<!-- Alex highlighting key information -->
<p>The most important skill for developers is <mark>problem solving</mark>.</p>
<p>Search results for "JavaScript": Found <mark>JavaScript</mark> in 847 projects.</p>
<p><mark>New:</mark> Added dark mode support to all projects.</p>localhost/index.html
Small Text
The<small> tag makes text smaller than normal. Use it for disclaimers, copyright notices, fine print, or side comments that are less important than the main content.
<!-- Alex adding fine print and disclaimers -->
<p>Download my free portfolio template!</p>
<p><small>By downloading, you agree to our terms of service.</small></p>
<p>Copyright 2024 Alex Johnson <small>(All rights reserved)</small></p>
<p>This project took 6 months <small>including planning and testing</small></p>localhost/index.html
Combining Format Tags
You can combine multiple formatting tags to create text that's both bold AND italic, or highlighted AND emphasized. Just nest the tags inside each other properly.<!-- Alex combining different formatting tags -->
<p>This is <strong><em>very important</em></strong> information!</p>
<p>Price: <mark><strong>$49 (Save 50%)</strong></mark></p>
<p>Old method: <s><em>complicated setup</em></s> New: <strong>one-click install</strong></p>
<p><strong>Warning:</strong> <mark>This feature is experimental</mark> <small>(use at your own risk)</small></p>localhost/index.html
What just happened?
The browser applied multiple formats to the same text. "Very important" is both bold and italic. The highlighted price is also bold. Try this: combine mark and strong tags around your most important content.
Wrong way to nest tags
<strong><em>text</strong></em> — This breaks because strong closes before em, but em opened after strong.Correct way:
<strong><em>text</em></strong> — em opens last, so it closes first. Then strong closes.Quiz
Alex wants to make the word "JavaScript" bold and indicate it's important content for screen readers. Which tag should they use?
Alex is writing about their favorite book and wants to format the title properly. Which tag is best for book titles?
Alex wants to make a sale price both bold and highlighted. Which combination is correct?
Up Next: Headings and Paragraphs
Learn to structure your content with proper headings and paragraph tags that make your pages easy to read and navigate.