HTML Typography Tutorial: Bold, Italic & Text Styling
Hey friend! ๐
Welcome back to our HTML Basics for Beginners series.
In the last tutorial, you learned how to:
- Create an HTML file
- Use headings and paragraphs
- Build your first webpage ๐
Nice job! Seriously.
But letโs be honest for a second ๐
Your page probably looked likeโฆ just text.
No structure. No flow. No โahh, this is easy to readโ feeling.
Today, we fix that.
This is Part 1 of our Typography series, where you’ll learn the fundamentals of HTML text formatting.
Letโs go ๐
What You’ll Learn Today
By the end of this HTML Typography tutorial, you’ll know how to:
โ
Make text bold and italic the right way
โ
Combine bold and italic formatting
โ
Underline, highlight, and resize text
โ
Show deleted and updated text
โ
Add line breaks and section dividers
โ
Build a mini project using all these skills
Letโs make your text feel like a real website ๐
Before You Start the HTML Typography tutorial
Prerequisites:
โ
Completed Tutorial #1 (HTML structure, headings, paragraphs)
โ
A text editor (VS Code, Notepad, etc.)
โ
A web browser (Chrome, Firefox, etc.)
Time to Complete: 15-20 minutes
Difficulty: Beginner-friendly โญ
Ready? Let’s make your text look professional! ๐
What Is Typography?
Typography means how text looks and feels.
Think about this:
- A WhatsApp message
- A newspaper
- A blog post
- A school textbook
Same language. Same letters.
But very different reading experiences, right?
That difference is typography.
Good typography:
- Helps readers understand faster ๐ง
- Feels clean and friendly
- Keeps people on your page
Bad typography:
- Looks like a big wall of text ๐ต
- Makes people leave fast
In HTML, typography helps you avoid “big wall of text” nightmares and makes your content actually enjoyable to read.
Quick Reminder: Headings & Paragraphs
You already know:
- Headings (
<h1>,<h2>,<h3>) - Paragraphs (
<p>)
Weโre not learning them again.
Today, weโre learning how to use them properly together so your text feels natural and readable.
Bad Text vs Good Text (Very Important)
โ Bad Example (Donโt Do This)
<h1>My Blog</h1>
<p>I love coding it is very fun and interesting and I want to learn HTML CSS JavaScript and build websites and projects</p>Why this is bad:
- One huge paragraph
- No breaks
- Hard to read
- Overwhelming
โ Good Example (Much Better!)
<h1>My Blog</h1>
<p>I love coding.</p>
<p>It is fun and interesting.</p>
<p>I want to learn HTML, CSS, and JavaScript to build websites.</p>Same content.
Much better reading experience.
๐ Golden Rule: One idea = one paragraph.
Step 1: Bold Text โ <b> vs <strong>
There are two ways to make text bold in HTML, and they’re not the same!
Just looks Bold: <b>
<p>This is <b>bold text</b>.</p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Use <b> when:
- You want text to look bold visually
- Thereโs no special meaning behind it
- You’re styling keywords or product names
Bold AND Important: <strong>
<p><strong>This is very important!</strong></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Use <strong> when:
- The text is actually important
- You want screen readers & browsers to treat it seriously
- The meaning matters, not just the style
๐ก Quick Tip:
<b>= style only (looks bold)<strong>= meaning (important information)
When in doubt? Use <strong> โ it’s better for accessibility.
Practice Challenge ๐ฏ
Write a paragraph about your favorite hobby and use <strong> to highlight the most important point.
Italic Text: <i> vs <em>
Just like bold, there are two ways to make text italic.
Just italic: <i>
<p>This is <i>italic text</i>.</p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Use <i> for:
- Names
- Book titles
- Thoughts
- Technical terms
- Foreign words
Emphasis: <em>
<p><em>Please read this carefully.</em></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Use <em> when:
- You want to stress something
- The sentence meaning changes with emphasis
- You’re adding vocal emphasis
๐ก Quick Tip:
<i>= visual style (titles, names)<em>= emphasis (stress, importance)
Example: See the Difference
<p>I <em>really</em> want to learn coding!</p>
<!-- Emphasis on "really" -->
<p>The movie <i>Inception</i> is mind-blowing.</p>
<!-- Title styling -->Practice Challenge ๐ฏ
Write three sentences: one with a book title, one with emphasis, and one with a movie name.
Step 3: Combining Bold and Italic
You can nest tags to combine formatting!
<p>This is <strong><em>extremely important</em></strong> information!</p>See the Pen Codeboid โ HTML Tutorial #2 โ Bold & Italic by Codeboid (@Codeboid) on CodePen.
Result: Text that’s both bold AND italic.
โ ๏ธ Important Rule:
Always close tags in the correct order (like parentheses in math).
โ Wrong:
<strong><em>Text</strong></em>โ Correct:
<strong><em>Text</em></strong>Think of it like opening and closing boxes โ the last one you opened must be the first one you close.
Step 4: Underline, Highlight & Small Text
Underline: <u>
<p><u>This text is underlined</u></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
โ ๏ธ Donโt overuse underline. Underlined text often looks like a link, which can confuse readers.
Good use cases:
- Highlighting text in documents
- Showing corrections
- Special formatting in educational content
Highlight Text: <mark>
<p>This is <mark>very important</mark> information.</p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Looks like a highlighter ๐๏ธ
Great for:
- Search results (highlighting keywords)
- Important notes in tutorials
- Drawing attention to key information
Small Text: <small>
<p><small>Terms and conditions apply.</small></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Used for:
- Side notes
- Legal text and disclaimers
- Copyright notices
- Footnotes
Practice Challenge ๐ฏ
Create a product description with a highlighted feature and a small print disclaimer.
Step 5: Deleted & Inserted Text (Showing Changes)
Sometimes, you donโt want to remove text completely.
Instead, you want to show that something was changed, updated, or corrected.
Deleted Text: <del>
<p><del>Old price: $100</del></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
What it does:
- Shows text with a line through it
- Visually means: โThis is no longer validโ
When to use <del>:
- Old prices
- Removed information
- Content that is no longer correct
๐ก Think of <del> as saying:
โThis was here before, but itโs not correct anymore.โ
Inserted Text: <ins>
<p><ins>New price: $80</ins></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
What it does:
- Shows new or added text
- Usually appears underlined by default
When to use <ins>:
- Updated information
- New content added after a change
- Corrections or improvements
๐ก Think of <ins> as saying:
โThis is the updated version.โ
Using <del> + <ins> Together (Very Common)
<p>
<del>Old price: $100</del><br>
<ins>New price: $80</ins>
</p>See the Pen Codeboid โ HTML Tutorial #2 โ + by Codeboid (@Codeboid) on CodePen.
This clearly tells the reader:
- What changed
- What is correct now
Very useful for:
- Product pages (price changes)
- Blog updates
- Change logs and revision history
Strikethrough Text: <s>
<p><s>This offer is no longer available</s></p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Difference between <s> and <del>:
<s>โ visual only (just looks crossed out)<del>โ semantic meaning (content was officially removed/replaced)
๐ก Simple rule:
<del>= meaningful change<s>= just showing something is no longer valid
Practice Challenge ๐ฏ
Create a sale announcement showing the old price crossed out and the new price highlighted.
Step 6: Line Breaks & Section Dividers
Now let’s learn how to control spacing and create visual breaks in your content.
Line Break: <br>
Use <br> when you want a new line within the same paragraph.
<p>
Roses are red,<br>
Violets are blue,<br>
HTML is easy,<br>
And you know it too ๐
</p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
Think of <br> as Shift + Enter.
When to use <br>:
โ
Poetry or song lyrics
โ
Addresses
โ
Short lines that belong together
When NOT to use <br>:
โ Creating space between paragraphs (use <p> tags instead)
โ For layout or design (that’s CSS’s job)
โ Multiple <br><br><br> for spacing (bad practice!)
Example: Address
<p>
John Doe<br>
123 Main Street<br>
New York, NY 10001<br>
USA
</p>Horizontal Line: <hr>
Want to separate sections visually?
Use <hr>:
<h2>Section 1</h2>
<p>Content here...</p>
<hr>
<h2>Section 2</h2>
<p>Content here...</p>See the Pen Codeboid โ HTML Tutorial #2 โ by Codeboid (@Codeboid) on CodePen.
This adds a horizontal line (divider).
Great for:
- New topics
- Blog sections
- Visual breaks between content
- Separating different parts of a page
Simple, but very powerful.
Practice Challenge ๐ฏ
Write a short poem using <br> for line breaks, then add an <hr> and write a second verse.
Step 7: Mini Project โ Product Sale Page
Okay, enough talking.
Let’s combine everything you’ve learned!
Create a file called sale-page.html and write this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flash Sale</title>
</head>
<body>
<h1>๐ Flash Sale Alert! ๐</h1>
<p>
<strong>Limited Time Offer!</strong><br>
<em>Only 24 hours left</em>
</p>
<hr>
<h2>Featured Product: <i>Ultra Wireless Headphones</i></h2>
<p>
Experience <mark>crystal-clear sound</mark> with our premium headphones.
</p>
<p>
<strong>Features:</strong><br>
<b>30-hour</b> battery life<br>
<b>Active noise</b> cancellation<br>
<b>Premium comfort</b> design
</p>
<hr>
<h2>Pricing</h2>
<p>
<del>Original Price: $199.99</del><br>
<ins>Sale Price: $129.99</ins>
</p>
<p>
<strong>Save $70!</strong> That's <mark>35% off</mark>!
</p>
<hr>
<h2>Order Now</h2>
<p>
Free shipping on orders over $100<br>
<small>Terms and conditions apply. Sale ends midnight.</small>
</p>
<p>
Contact us:<br>
123 Tech Street<br>
San Francisco, CA 94105<br>
USA
</p>
<hr>
<footer>
<p><small>All prices in USD. <s>Previous offers</s> no longer valid.</small></p>
</footer>
</body>
</html>See the Pen Codeboid โ HTML Tutorial #2 โ Mini Project by Codeboid (@Codeboid) on CodePen.
Your Turn! ๐ฏ
Customize this page:
- Change the product to something you’d sell
- Add your own features using
<b>and<br> - Create a different sale price
- Add your own address
- Experiment with
<mark>,<strong>, and<em>
๐ Open it in your browser.
If you understand what each part does โ you’ve nailed typography! ๐
Typography Cheat Sheet (Part 1)
Quick reference for tags you learned today:
BOLD & ITALIC
<strong>text</strong> โ Bold (important)
<b>text</b> โ Bold (visual only)
<em>text</em> โ Italic (emphasis)
<i>text</i> โ Italic (visual only)
HIGHLIGHTING & SPECIAL
<mark>text</mark> โ Highlight
<u>text</u> โ Underline
<small>text</small> โ Small text
SHOWING CHANGES
<del>text</del> โ Deleted
<ins>text</ins> โ Inserted
<s>text</s> โ Strikethrough
SPACING & DIVIDERS
<br> โ Line break
<hr> โ Horizontal lineQuick Recap: What You Learned Today
โ
The difference between <b> and <strong>
โ
The difference between <i> and <em>
โ
How to combine bold and italic
โ
How to highlight text with <mark>
โ
How to show changes with <del> and <ins>
โ
How to add line breaks and dividers
โ
Built a complete sale page project
Great job! ๐
Common Beginner Mistakes (Totally Normal)
โ Making everything bold (kills impact)
โ Using <br> instead of <p> for paragraphs
โ Underlining non-links (confuses readers)
โ Closing tags in the wrong order
If youโve done any of these โ congrats ๐
That means youโre learning.
Thatโs a big upgrade from plain text.
What’s Next?
Coming Up in Part 2:
- Quotes and citations
- Displaying code properly
- Special characters (ยฉ, ยฎ, โฌ, etc.)
- Subscript and superscript
- Mini project: Book review page
Practice Challenge ๐ช
Before moving to Part 2, create a page about your favorite movie that includes:
- Movie title in italic
- Your rating with bold text
- A highlighted quote
- Old vs new release date (using
<del>and<ins>) - Theater address with line breaks
- Horizontal lines between sections
Get the Source Code
๐ Codeboid/html-series
Final Thoughts on Text Formatting
You just learned the foundations of text formatting! These simple tags are used on every professional website.
Practice by creating different pages: sale announcements, event invitations, product descriptions.
Keep going โ you’re building real skills! ๐ช
See you in Part 2! ๐ฑ
