Text Formatting with HTML

Chapter 5: Formatting Text with HTML

HTML, an acronym for HyperText Markup Language, is the backbone of almost every website on the internet. It is used to structure the content of a web page and includes several tags to format and organize the text. In this chapter, we will explore the various ways to format text using HTML.

1. Title Elements

Heading elements in HTML are used to define the titles and subtitles of a page. They range from <h1> to <h6>, with <h1> being the largest and most important, and <h6> being the smallest and least important. For example:

<h1>This is an H1 heading</h1>
<h2>This is an H2 heading</h2>
<h3>This is an H3 heading</h3>
    

2. Paragraph Elements

The paragraph element <p> is probably the most commonly used in HTML text formatting. It is used to define a paragraph of text. For example:

<p>This is an example of a paragraph in HTML.</p>
    

3. Elements of Emphasis

There are several emphasis elements in HTML that allow you to change the appearance of text to highlight important parts. The most common are <strong>, for bold text, and <em>, for italic text. For example:

<strong>This text is in bold.</strong>
<em>This text is in italics.</em>
    

4. List Elements

Lists are an important part of HTML text formatting. There are two main types of lists: ordered lists (<ol>) and unordered lists (<ul>). Ordered lists have numbers or letters as bullets, while unordered lists have bullet points. For example:

<ol>
  <li>This is the first item in an ordered list.</li>
  <li>This is the second item in an ordered list.</li>
</ol>

<ul>
  <li>This is the first item in an unordered list.</li>
  <li>This is the second item in an unordered list.</li>
</ul>
    

5. Link Elements

The link element <a> is used to create links in HTML. You can use the href attribute to define the link URL. For example:

<a href="https://www.example.com">This is a link to example.com</a>
    

6. Citation Elements

There are several citation elements in HTML that allow you to format text citations in various ways. For example, <blockquote> is used for long block quotes, while <q> is used for short in-line quotes. For example:

<blockquote>This is a long block quote.</blockquote>
<q>This is a short inline quote.</q>
    

These are just a few examples of how you can format text using HTML. There are many other elements and attributes available, and the best way to learn about them is to practice and experiment on your own. Remember, the purpose of HTML text formatting is to make your web page content clear and easy to read for your users.

Now answer the exercise about the content:

What is the purpose of text formatting in HTML?

You are right! Congratulations, now go to the next page

You missed! Try again.

Article image Lists and tables in HTML 41

Next page of the Free Ebook:

Lists and tables in HTML

Estimated reading time: 5 minutes

Download the app to earn free Certification and listen to the courses in the background, even with the screen off.

+ 9 million
students

Free and Valid
Certificate

60 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video and ebooks