Course Content
HTML Tutorial
About Lesson

Text formatting (bold, italic, underline).

In the vast world of web development, mastering HTML is essential. One crucial aspect is text formatting, which includes making text bold, italic, and underlined. Let’s delve into the basics of these formatting techniques and how they enhance the visual appeal of your web content.

The <strong> Tag for Bold Text

When you want to emphasize the importance of certain text or make it stand out, the <strong> tag comes to the rescue. This tag is used to define strong importance, and browsers typically render text within these tags as bold. Here’s a quick example:

<p>This is a <strong>bold</strong> statement.</p>

Italicizing Text with <em>

To add a touch of emphasis or to highlight a particular word or phrase, you can use the <em> tag. This tag signifies emphasized text and is usually displayed as italicized by browsers:

<p>This text is <em>italicized</em>.</p>

Underlining Text with <u>

Sometimes, you may want to underline text for various reasons. While underlining is not as commonly used in modern web design, the <u> tag can still be employed:

<p>This text is <u>underlined</u>.</p>

Combining Formatting Tags

HTML allows you to combine formatting tags for more intricate styling. For instance, if you want to emphasize and underline text simultaneously, you can nest the tags accordingly:

<p>This text is both <strong><u>bold and underlined</u></strong>.</p>

CSS Styling for Text Formatting

While HTML provides basic tags for text formatting, Cascading Style Sheets (CSS) can be used for more advanced and customized styles. You can apply styles globally to specific HTML elements or use inline styles for individual tags.

<style>
.important-text {
font-weight: bold;
font-style: italic;
text-decoration: underline;
}
</style>

<p class="important-text">This text is styled using CSS.</p>