Formatting text in HTML

More options for you.


General KnowledgeEnglish GrammarMathScienceIQ-TestQuiz-Test

We are now ready to learn how to formate HTML text with the formatting element.
We can use some special elements for formatting output like:
<b> for bold text
<i> for italic text
<mark> for marked text
<ins> for inserted text
<del> for deleted text
<sup> for superscript text
<sub> for subscript text
<small> for smaller text
It is the time to apply our special elements for formatting HTML text and have a look how the browsers display it as below.

Bold and italic formatting:


Let's change the default text of our HTML document to bold and italic.

HTML Editor

<html>
<body>
<h2> <i> This heading is italic </i> </h2>
<p> <b> This paragraph is bold </b> </p>
<p> This paragraph is normal </p>
</body>
</html>

Web Browser

This heading is italic

This paragraph is bold

This paragraph is normal

Deleted and inserted formatting.

Let's change the default text of our HTML document to deleted and inserted.

HTML Editor

<html>
<body>
<h2> Pen through the <del> word </del> </h2>
<h2> <ins> The </ins> water of this glass is pure </h2>
</body>
</html>

Web Browser

Pen through the word

The water of this glass is pure

Superscript and subscript formatting.

Let's change the default text of our HTML document to Superscript and subscript.

HTML Editor

<html>
<body>
<h2> The 1 <sup> st </sup> May is labourday </h2>
<h3> The other name of H <sub> 2 </sub>O is life </h3>
</body>
</html>

Web Browser

The 1st May is labourday

The other name of H2O is life

Marked and smaller formatting.

Let's change the default text of our HTML document to marked and smaller.

HTML Editor

<html>
<body>
<h3> There are many <small> small </small> island in Bangladesh </h3>
<h4> Notice the <mark> marked </mark> word attentively </h4>
</body>
</html>

Web Browser

There are many small island in Bangladesh

Notice themarked word attentively

Note: The background-color attribute, <font> tag, <center> tag supported in older versions of HTML but they are not valid in (latest version) HTML5. Font-family, font-size, text-align etc are the CSS property and the value of them are also the CSS value.
We will try to learn more about CSS in the next chapter.



More options for you.


General KnowledgeEnglish GrammarMathScienceIQ-TestQuiz-Test