Text Formatting in HTML

 Text formatting in HTML (Hypertext Markup Language) is achieved using various tags to change text styles and structure. Here's a brief explanation of some common HTML tags used for text formatting:

<strong>: The <strong> tag is used to indicate strong importance or emphasis. Text enclosed within this tag is typically displayed in a bold font.

html code

<p>This is <strong>important</strong> text.</p>

<em>: The <em> tag is used to emphasize text, often rendering it in italics or with another style depending on the browser's default settings.

html code

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

<u>: The <u> tag is used to underline text. However, it's important to note that underlining text for non-link text is generally discouraged for readability and accessibility reasons.

html code

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

<s>: The <s> tag is used to indicate text that has been strikethrough, often representing deleted or obsolete content.

html code

<p>This text is <s>strikethrough</s>.</p>

<sub>: The <sub> tag is used to create subscript text, which is typically smaller and positioned below the baseline of the text.

html code

<p>This is H<sub>2</sub>O, which is water.</p>

<sup>: The <sup> tag is used to create superscript text, which is typically smaller and positioned above the baseline of the text.

html code

<p>The square of 4 is 4<sup>2</sup>.</p>

<br>: The <br> tag is used to insert line breaks within text, forcing text following the tag to appear on a new line.

html code

<p>This is the first line.<br>This is the second line.</p>

These tags are just a few examples of how HTML can be used to format text. HTML provides a wide range of formatting options, and you can also use CSS (Cascading Style Sheets) to control the visual appearance of text and other elements in a more flexible and consistent manner.

Comments

Popular posts from this blog

Shopping cart in PHP

What are the different ways of handling the result set of MySQL in PHP?

Google pagination in PHP

PHP admin panel with class

Navigating the WordPress dashboard