Formatting is one of the crucial sections of every web development. It plays an essential role in making content attractive, readable, and appealing. Formatting can be defined as the appearance of your documentation or presentation of your HTML code in a meaningful and more beautiful way. Formatting is mainly done to make the layout attractive.
HTML provides various formatting tags. They are collectively called formatting tags as they are meant for the abovementioned purpose. So, in this chapter, you will learn about these formatting tags and how to use them.
Formatting elements in HTML were created primarily to display text in a specific way:
|To make any text underlined.|
|To make any text bold.|
|It is used in texts that are important and need to be highlighted.|
|To make any text italic.|
|To emphasize any text.|
|To make any text marked or highlighted.|
|To make the text smaller in size than other regular text.|
|To make the text bigger in size than other regular text.|
|To show the text that has been removed or replaced.|
|To show the text that has been added.|
|To give a subscript effect to any text.|
|To give a superscript effect to any text.|
|To display any text as a strikethrough.|
|For displaying any font as a monospaced font. This tag is abbreviated as a typewriter font tag.Let's check this out by using an example program:|
<!DOCTYPE html> <html> <head> <title>Formatting elements example</title> </head> <body> This makes ur <u> text </u> underlined <br /> This is a <b> bold </b> man <br /> This is a <strong> Strong </strong> creature <br /> I stands for <i> italics </i> <br /> This will <em> emphasize </em> your text <br /> This will <mark> highlight </mark> your word <br /> This is a <small> small </small> island <br /> This is a <big> Big </big> river <br /> I want red color, not <del> green </del> <br /> Please insert <ins> THIS </ins> instead of THAT <br /> H<sub> 2 </sub> O <br /> x <sup> 3 </sup> <br /> I want red color, not <strike> green </strike> <br /> This is a <tt> different </tt> font </body> </html>
Click on the "Run Code" button above to see how the code works.