Text Formatting in HTML-2

<q> tag– The <q> tag defines a short quotation. Browsers normally insert quotation marks around the quotation.

Example-

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title> q Tag</title>

</head>

<body>

<p>WWF’s goal is to:
<q>Build a future where people live in harmony with nature.</q>
We hope they succeed.</p>

</body>
</html>

<sub> tag– The <sub> tag defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O.

Example-

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title> sub Tag</title>

</head>

<body>

<p>This text contains <sub>subscript</sub> text.</p>

</body>

</html>

<sup> tag– The <sup> tag defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font.

Example-

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title> sup Tag</title>

</head>

<body>

<p>This text contains <sup>superscript</sup> text.</p>

</body>

</html>

<code> tag– The <code> tag is used for displaying computer codes in a suitable font.

Example-

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title> Code Tag</title>

</head>

<body>

<code>A piece of computer code</code>

</body>

</html>

<s> tag– The <s> tag specifies text that is no longer correct, accurate or relevant. The <s> tag should not be used to define replaced or deleted text, use the <del> tag to define replaced or deleted text.

Example-

<!DOCTYPE html>

<html lang=”en-US”>

<head>

<title> S Tag</title>

</head>

<body>

<p><s>My car is blue.</s></p>
<p>My new car is silver.</p>

</body>

</html>

Exercise-

Write a code in html to generate the following output: