HTML Text Formatting Techniques

HTML Text Formatting Techniques: We have already learnt about style element using which we may alter or change the look of our content within an HTML document but there are a few HTML formatting options like bold, italic, underlined, computer code, highlighted etc. Let us look at the examples of each one of these.

Bold Formatting of Text in HTML with <strong>:

Though HTML does have a straight forward <b></b> for marking a text bold but as of W3C’s recommendations, we must not use it for merely presentational reasons. The best way to mark a text bold is: <strong>text</strong>. The example below depicts what <strong> does to the text:

Example 1: HTML Code Showing Text Formatting:

 <p> My First Paragraph </p>

<p>My Second Paragraph </p>

<p><strong> My Third Paragraph<strong></p>


HTML Text Formatting Bold

Example 2: Marking Text Bold:

Let’s make only the word “Third” bold in the last line or paragraph:

HTML Code:

<p>My <strong>Third</strong> Paragraph</p>

HTML Output:

HTML Formatting