HTML Text Format
HTML (Hypertext Markup Language) allows you to format and structure text in web pages. There are various HTML tags and attributes that you can use for text formatting. Here are some commonly used ones:
Headings: HTML provides six levels of headings, from <h1>
to <h6>
, with <h1>
being the highest level and <h6>
the lowest. Headings are used to create titles and subtitles for sections of a webpage.
1 2 3 4 5 |
<h1>This is a Heading 1</h1> <h2>This is a Heading 2</h2> ... <h6>This is a Heading 6</h6> |
Paragraphs: The <p>
tag is used to define paragraphs of text.
1 2 |
<p>This is a paragraph.</p> |
Bold and Italic: The <b> tag is used to make the text bold, and the <i> tag is used to make the text italic.
1 2 3 |
<b>This is bold text.</b> <i>This is italic text.</i> |
Underline: The <u>
tag is used to underline text.
1 2 |
<u>This is underlined text.</u> |
Strikethrough: The <s>
or <strike>
tag is used to apply a strikethrough effect to the text.
1 2 |
<s>This is strikethrough text.</s> |
Superscript and Subscript: The <sup>
tag is used to create superscript text, and the <sub>
tag is used for subscript text.
1 2 |
E = mc<sup>2</sup> H<sub>2</sub>O |
Text Color: The color
attribute is used to specify the color of the text. It can be applied to various tags.
1 2 3 |
<p style="color: red;">This is red text.</p> <span style="color: blue;">This is blue text.</span> |
<strong>
-Important text: It defines Strong text with added strong importance.
<i>
-Italic text: This element shows Italic text.
<em>
-Emphasized text: It emphasizes the text with added semantic importance.
<mark>
-Marked text: It marks the text.
<small>
-Small text: Element defines smaller text.
<del>
-Deleted text: Element defines remove text.
<ins>
-Inserted text: Element defines added text.
<sub>
– Subscript text.
<sup>
-Superscript text.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<html> <head> <title>Text Formatting Example</title> </head> <body> <b>Tutorials Example</b> <strong>Tutorials Example</strong> <i>Tutorials Example</i> <em>Tutorials Example</em> <mark>Tutorials Example</mark> <b>Tutorials Example</b> <small>Tutorials Example</small> <del>Tutorials Example </del> <ins>Tutorials Example</ins> <sub>Tutorials Example</sub> <sup>Tutorials Example</sup> </body> </html> |
Output
Tutorials Example
Tutorials Example
Tutorials Example
Tutorials Example
Tutorials Example
Tutorials Example
Tutorials Example
Tutorials Example
Tutorials Example