HTML Formatting
HTML Formatting
HTML Formatting is a process of formatting text for better look and feel. There are many formatting tags in HTML. These tags are used to make text bold, italicized, or underlined. There are almost 12 options available that how text appears in HTML and XHTML.
HTML Formatting Tags
Bold Text
If you write anything within <b>............</b> element, is shown in bold letters.
Example:
<p> <b>Write Your First Paragraph in bold text.</b></p>
Output: Write Your First Paragraph in bold text.
Italic Text
If you write anything within <i>............</i> element, is shown in italic letters.
Example:
<p> <i>Write Your First Paragraph in italic text.</i></p>
Output: Write Your First Paragraph in italic text.
HTML Marked formatting
If you want to mark or highlight a text, you should write the content within <mark>.........</mark>.
Example:
<h2> I want to put a <mark> Mark</mark> on your face</h2>
Output: I want to put a Mark on your face
Underlined Text
If you write anything within <u>.........</u> element, is shown in underlined text.
Example:
<p> <u>Write Your First Paragraph in underlined text.</u></p>
Output: Write Your First Paragraph in underlined text.
Strike Text
Anything written within <strike>.......................</strike> element is displayed with strikethrough. It is a thin line which cross the statement.
Example:
<p> <strike>Write Your First Paragraph with strikethrough</strike>.</p>
Output: Write Your First Paragraph with strikethrough.
Monospaced Font
If you want that each letter has the same width then you should write the content within <tt>.............</tt> element.
Note: We know that most of the fonts are known as variable-width fonts because different letters have different width. (for example: 'w' is wider than 'i'). Monospaced Font provides similar space among every letter.
Example:
<p>Hello <tt>Write Your First Paragraph in monospaced font.</tt></p>
Output: Hello Write Your First Paragraph in monospaced font.
Superscript Text
If you put the content within <sup>..............</sup> element, is shown in superscript ; means it is displayed half a character's height above the other characters.
See this example:
<p>Hello <sup>Write Your First Paragraph in superscript.</sup></p>
Output: Hello Write Your First Paragraph in superscript.
Subscript Text
If you put the content within <sub>..............</sub> element, is shown in subscript ; means it is displayed half a character's height below the other characters.
Example:
<p>Hello <sub>Write Your First Paragraph in subscript.</sub></p>
Output: Hello Write Your First Paragraph in subscript.
Deleted Text
Anything that puts within <del>..........</del> is displayed as deleted text.
Example:
<p>Hello <del>Delete your first paragraph.</del></p>
Output: Hello Delete your first paragraph.
Inserted Text
Anything that puts within <ins>..........</ins> is displayed as inserted text.
Example:
<p> <del>Delete your first paragraph.</del><ins>Write another paragraph.</ins></p>
Output: Delete your first paragraph.Write another paragraph.
Larger Text
If you want to put your font size larger than the rest of the text then put the content within <big>.........</big>. It increase one font size larger than the previous one.
Example:
<p>Hello <big>Write the paragraph in larger font.</big></p>
Output: Hello Write the paragraph in larger font.
Smaller Text
If you want to put your font size smaller than the rest of the text then put the content within <small>.........</small>tag. It reduces one font size than the previous one.
Example:
<p>Hello <small>Write the paragraph in smaller font.</small></p>
