DEV Community

Cover image for HTML Text Formatting
MAK Writing House
MAK Writing House

Posted on • Originally published at makwritinghouse.com

HTML Text Formatting

Introduction:

Text formatting is an integral part of creating visually appealing and engaging web content. HTML provides a range of tags that allow you to apply various text formatting styles. In this comprehensive guide, we will explore the different text formatting tags, including bold, italic, underline, and strikethrough. By understanding these tags and their usage, you will gain the ability to add emphasis, structure, and visual impact to your textual content.

The Bold Formatting Tags: <b> and <strong>

The <b> and <strong> tags are used to apply bold formatting to text. These tags indicate that the enclosed text should appear in a bold typeface. The <b> tag is a presentational tag, while the <strong> tag carries semantic importance. To apply bold formatting, simply wrap the desired text within the opening and closing tags:

code:

<b>This text will be bold</b>
Enter fullscreen mode Exit fullscreen mode

or

<strong>This text will be bold</strong>
Enter fullscreen mode Exit fullscreen mode

something look like this:

Image description

Both tags serve the same purpose of making specific words or phrases stand out. However, the <strong> tag carries more weight in terms of semantic significance, indicating that the text is of importance or carries emphasis.

The Italic Formatting Tags: <i> and <em>

The <i> and <em> tags are used to apply italic formatting to text. These tags signify that the enclosed text should appear in an italicized typeface. Similar to the bold formatting tags, you can apply italic formatting by enclosing the desired text within the opening and closing tags:

code:

<i>This text will be italicized</i>
Enter fullscreen mode Exit fullscreen mode

or

<em>This text will be italicized</em>
Enter fullscreen mode Exit fullscreen mode

Image description

Both tags serve the same purpose of indicating emphasis or adding stylistic variation to the text. However, the <em> tag carries semantic importance, suggesting emphasis or importance within the context.

The Underline Formatting Tags: <u> and <ins>

The <u> and <ins> tags are used to apply underline formatting to text. These tags indicate that the enclosed text should appear with an underline. To apply underline formatting, wrap the desired text within the opening and closing tags:

code:

<u>This text will be underlined</u>
Enter fullscreen mode Exit fullscreen mode

or

<ins>This text will be underlined</ins>
Enter fullscreen mode Exit fullscreen mode

Image description

Both tags serve the same purpose of visually differentiating text. However, the <ins> tag carries semantic significance, suggesting that the text has been inserted or is an addition to the content.

The Strikethrough Formatting Tags: <del> and <s>

The <del> and <s> tags are used to apply strikethrough formatting to text. These tags indicate that the enclosed text should appear with a horizontal line through the middle. To apply strikethrough formatting, enclose the desired text within the opening and closing tags:

<del>This text will be strikethrough</del>
Enter fullscreen mode Exit fullscreen mode

or

<s>This text will be strikethrough</s>
Enter fullscreen mode Exit fullscreen mode

code:

All three tags serve the same purpose of visually representing deleted or outdated information. However, the <del> tag carries semantic significance, indicating that the text has been deleted or removed.

Conclusion:

Understanding text formatting tags such as bold, italic, underline, and strikethrough is essential for creating visually appealing and structured web content. By utilizing these tags, you can emphasize key points, highlight quotations, differentiate content, and provide visual cues to your audience. It’s important to choose the appropriate tag based on both presentational and semantic considerations.

Remember to use text formatting tags judiciously, as excessive or improper usage may result in decreased readability or accessibility. Additionally, keep in mind that CSS (Cascading Style Sheets) provides more advanced options for text formatting, enabling you to customize fonts, sizes, colors, and other aspects of typography.

As you continue to explore HTML and CSS, consider combining these text formatting tags with other HTML elements to create dynamic and engaging web pages. With practice and a keen eye for design, you will master the art of using text formatting tags effectively, enhancing the impact and clarity of your web content. Happy coding!

Github Repo: HTML => HTML Tags: Bold, Italic, Underline, and Strikethrough

This Journey will be continue…

Top comments (2)

Collapse
 
fruntend profile image
fruntend

Сongratulations 🥳! Your article hit the top posts for the week - dev.to/fruntend/top-10-posts-for-f...
Keep it up 👍

Collapse
 
makwritinghouse profile image
MAK Writing House

😇