Press F for Fullscreen
1/8
REC
1
8

HTML Text Formatting Typography & Styling Content Presentation

Part 5: Mastering Text Formatting in HTML

Instructor

Simegnew Destew

Senior Full-Stack Developer

Part 5: HTML Text Formatting

Headings & Paragraphs

Structural Text Elements
<h1>

Main Heading - Most Important

<h2>

Section Heading - Very Important

<h3>

Subsection Heading - Important

<h4>

Minor Heading - Some Importance

<h5>
Small Heading - Less Important
<h6>
Tiny Heading - Least Important

Paragraphs & Line Breaks

P

<p> Paragraphs

The <p> tag defines a paragraph of text.

  • Browsers automatically add margin before and after paragraphs
  • Used for blocks of text content
  • Should contain related sentences and ideas
  • Essential for readability and content structure
<p>This is a paragraph of text that contains multiple sentences and forms a complete thought or idea.</p>
BR

<br> Line Breaks

The <br> tag creates a line break within text.

  • Empty element (no closing tag needed)
  • Useful for addresses, poetry, or forced line breaks
  • Not for creating space between paragraphs
  • Should be used sparingly and semantically
First line of text<br>
Second line of text<br>
Third line of text
Part 5: HTML Text Formatting

Basic Text Formatting

Emphasis and Styling Tags
B

<b> & <strong>

Bold Text

<b> is for stylistic bold, while <strong> indicates importance.

<b>Bold Text</b> vs <strong>Important Text</strong>
Bold Text vs Important Text
I

<i> & <em>

Italic Text

<i> is for stylistic italic, while <em> indicates emphasis.

<i>Italic Text</i> vs <em>Emphasized Text</em>
Italic Text vs Emphasized Text
U

<u>

Underlined Text

The <u> tag underlines text. Use sparingly as it can be confused with links.

<u>Underlined Text</u>
Underlined Text
S

<small>

Small Text

The <small> tag makes text one size smaller than the default.

Normal text <small>Small text</small>
Normal text Small text
SUB

<sub>

Subscript Text

The <sub> tag creates subscript text, commonly used in chemical formulas.

H<sub>2</sub>O
H2O
SUP

<sup>

Superscript Text

The <sup> tag creates superscript text, commonly used in mathematical expressions.

x<sup>2</sup> + y<sup>2</sup>
x2 + y2
NOTE

Semantic Importance: Use <strong> and <em> when you want to convey meaning, not just styling. Screen readers will emphasize these elements.

Part 5: HTML Text Formatting

Interactive Formatting Demo

See Formatting in Real-Time
HTML Editor
<h1>Welcome to Text Formatting</h1> <p>This is a <strong>paragraph</strong> demonstrating various text formatting options.</p> <p>You can make text <b>bold</b>, <i>italic</i>, or <u>underlined</u>.</p> <p>Scientific notation: H<sub>2</sub>O and E=mc<sup>2</sup></p> <p><small>Small text for disclaimers</small></p>
Live Preview

How to Use:

  1. Select text in the editor
  2. Click a formatting button to apply the tag
  3. See the result instantly in the preview
  4. Edit the HTML directly to learn the syntax
Part 5: HTML Text Formatting

Special Formatting Tags

Advanced Text Elements
🔖

<mark>

Highlighted or marked text

<mark>Important information</mark>
This contains highlighted text for emphasis.
📄

<pre>

Preformatted text preserving spaces and line breaks

<pre>Text with multiple spaces</pre>
This text
  preserves   all
    spaces and
      line breaks
📍

<address>

Contact information for the author

<address>Contact: author@example.com</address>
Written by John Doe
Visit us at:
Example.com
Box 564, Disneyland
USA
🔄

<bdo>

Bi-directional override for text direction

<bdo dir="rtl">This text is reversed</bdo>
Normal: Left to Right
Reversed: Right to Left

<del>

Deleted text (strikethrough)

<del>Old price: $100</del>
Old price: $100 New price: $75

<ins>

Inserted text (underlined)

<ins>New content added</ins>
Original text with inserted content continues here.

Usage Tips:

<mark> for Search Results

Perfect for highlighting search terms in results

<pre> for Code

Ideal for displaying code snippets with proper formatting

<del> and <ins> for Revisions

Great for showing document changes and edits

<bdo> for Internationalization

Essential for languages with right-to-left writing

Part 5: HTML Text Formatting

Semantic vs Stylistic Formatting

Choosing the Right Tag
Tag Type Purpose Example When to Use
<b> Stylistic Visual bold without importance Product names When you want text to stand out visually
<strong> Semantic Indicates strong importance Warning messages When content is important for understanding
<i> Stylistic Visual italic without emphasis Technical terms For technical terms, foreign phrases, thoughts
<em> Semantic Indicates emphasized text Key points When you want to stress certain words
<mark> Semantic Highlights relevant content Search results For highlighting relevant content in context
<small> Semantic Side comments and fine print Copyright info For legal text, disclaimers, copyright

Accessibility Benefits of Semantic Tags:

🎯

Screen Readers

Semantic tags are announced with proper emphasis

🔍

Search Engines

Search algorithms understand content importance

🎨

Styling Consistency

CSS can style semantic elements appropriately

📱

Future Compatibility

Semantic HTML works better with new technologies

BEST PRACTICE

Always prefer semantic tags (<strong>, <em>) over stylistic tags (<b>, <i>) when you want to convey meaning, not just appearance.

Part 5: HTML Text Formatting

Comprehensive Formatting Demo

Building a Formatted Article
Formatted Article Code
<article> <h1>The <mark>Science</mark> of Web Development</h1> <p>Web development combines <strong>technical skills</strong> with <em>creative design</em> to build amazing digital experiences.</p> <h2>Core Technologies</h2> <p>The foundation of web development rests on three pillars:</p> <ul> <li><strong>HTML</strong> for structure</li> <li><strong>CSS</strong> for presentation</li> <li><strong>JavaScript</strong> for behavior</li> </ul> <h3>Chemical Inspiration</h3> <p>Just as H<sub>2</sub>O forms the basis of life, these three technologies form the basis of the web. The formula for success is:</p> <p><strong>Great Website = HTML + CSS + JavaScript</strong></p> <h3>Mathematical Foundation</h3> <p>The complexity of a website can be expressed as C = f(HTML<sup>2</sup>, CSS<sup>3</sup>, JS<sup>n</sup>) where n represents interactive features.</p> <hr> <p><small>Article last updated: January 2024</small></p> <address> Written by <strong>Web Dev Team</strong><br> Email: team@devvoltz.com<br> Website: www.devvoltz.com </address> </article>
Article Preview

The Science of Web Development

Web development combines technical skills with creative design to build amazing digital experiences.

Core Technologies

The foundation of web development rests on three pillars:

  • HTML for structure
  • CSS for presentation
  • JavaScript for behavior

Chemical Inspiration

Just as H2O forms the basis of life, these three technologies form the basis of the web. The formula for success is:

Great Website = HTML + CSS + JavaScript

Mathematical Foundation

The complexity of a website can be expressed as C = f(HTML2, CSS3, JSn) where n represents interactive features.


Article last updated: January 2024

Written by Web Dev Team
Email: team@devvoltz.com
Website: www.devvoltz.com

Formatting Techniques Used:

<h1>-<h3> Headings <strong> Importance <em> Emphasis <mark> Highlighting <sub> Subscript <sup> Superscript <small> Fine Print <address> Contact Info <hr> Horizontal Rule
COMPLETE

Formatting Mastered!

You've Learned HTML Text Formatting

What We Covered in Part 5:

📊

Headings

h1-h6 for content hierarchy

📝

Paragraphs & Breaks

p for content, br for line breaks

🔠

Basic Formatting

bold, italic, underline, small

🔢

Scientific Notation

sub and sup for formulas

🎯

Special Tags

mark, pre, address, bdo

🔄

Edits & Changes

del and ins for revisions

Practice Exercise:

Create a Formatted Product Page

Build an HTML page for a product with:

  • Proper heading structure
  • Formatted product description
  • Price with old and new prices using del/ins
  • Technical specifications with sub/sup
  • Contact information in address
  • Highlighted key features

Text Formatting Best Practices:

🎯

Use Semantic Tags

Prefer strong/em over b/i for meaning

📐

Maintain Hierarchy

Use headings in proper order (h1 → h6)

🎨

Don't Overformat

Use formatting sparingly for emphasis

Consider Accessibility

Screen readers interpret semantic tags

Next: Learn about ordered/unordered lists, definition lists, and creating tables

Presenter Notes - Video 5

Intro Slide: Emphasize that text formatting is essential for readability, accessibility, and user experience. Good formatting makes content scannable and understandable.
Headings & Paragraphs: Demonstrate the visual hierarchy of headings. Show how screen readers use heading structure for navigation.
Basic Formatting: Live demonstration of each formatting tag. Show the difference between b/strong and i/em with screen reader if possible.
Interactive Demo: Let students experiment with the editor. Show how to select text and apply formatting. Demonstrate common mistakes.
Special Tags: Show real-world use cases for each special tag. Demonstrate how pre preserves formatting for code examples.
Semantic vs Stylistic: Emphasize the importance of semantic HTML for accessibility and SEO. Show examples of when to use each type.
Comprehensive Demo: Walk through the article code. Point out how different formatting techniques work together to create readable content.
Recap: Summarize key formatting tags. Assign the product page exercise. Preview lists and tables for next video.
🎓 HTML Text Formatting - DevVoltz Academy 🌐 Website: www.devvoltz.com 📱 Telegram: @devvoltz 📸 Instagram: @devvoltz 👥 Facebook: facebook.com/devvoltz 💻 Next: HTML Lists & Tables