HTML text styles (bold, italic, underline)
Hello, students! In this lesson, we will learn about HTML text styles.
Text styles are used to change the appearance of text on a web page.
The most common HTML text styles are bold, italic, and underline.
Topics
- What are HTML text styles?
- Bold
- Italic
- Underline
- Code examples
What are HTML text styles?
Text styles are used to change the appearance of text on a web page.
They are used to emphasize text or make it easier to read.
Bold
Bold text is darker and more prominent.
It is used to emphasize text or draw attention to it.
To use bold, use the <strong>
tag.
Code Example
<p>This is <strong>bold</strong> text.</p>
The browser displays the text as follows:
This is bold text.
Italic
Italic text is slanted.
It is used to emphasize text or indicate that it is a quote or a note.
To use italics, use the <em>
tag.
Code Example
<p>This is <em>italic</em> text.</p>
The browser displays the text as follows:
This is italic text.
Underline
Underlined text is drawn with a line below it.
It is used to emphasize text or indicate that it is a link.
To use underline, use the <u>
tag.
Code Example
<p>This is <u>underlined</u> text.</p>
The browser displays the text as follows:
This is underlined text.
Exercises
- Create an HTML document with a paragraph containing bold, italic, and underlined text.
- Save the document and open it in a browser.
Observe how the browser displays the text with the different styles.
Good luck!
Conclusion
Text styles are an important tool to emphasize text and make it easier to read.
Understanding how to use them correctly is essential for creating effective web pages.
In the next module, we will learn about HTML list elements.
List elements are used to organize text on a web page.
The most common HTML list elements are unordered lists, ordered lists, and definition lists.
Are you ready to learn more?