HTML Text Formating - SwatiMaurya08/html-notes GitHub Wiki

HTML Text Formating

Bold Text

Anything that appears within <b>...</b> element, is displayed in bold.

Italic Text

Anything that appears within <i>...</i> element is displayed in italicized.

Underlined Text

Anything that appears within <u>...</u> element, is displayed with underline.

Strike Text

Anything that appears within <strike>...</strike> element is displayed with strikethrough, which is a thin line through the text.

Monospaced Font

The content of a <tt>...</tt> element is written in monospaced font. Most of the fonts are known as variable-width fonts because different letters are of different widths (for example, the letter 'm' is wider than the letter 'i'). In a monospaced font, however, each letter has the same width.

Superscript Text

The content of a <sup>...</sup> element is written in superscript; the font size used is the same size as the characters surrounding it but is displayed half a character's height above the other characters.

Subscript Text

The content of a <sub>...</sub> element is written in subscript; the font size used is the same as the characters surrounding it, but is displayed half a character's height beneath the other characters.

Inserted Text

Anything that appears within <ins>...</ins> element is displayed as inserted text.

Deleted Text

Anything that appears within <del>...</del> element, is displayed as deleted text.

Larger Text

The content of the <big>...</big> element is displayed one font size larger than the rest of the text surrounding it.

Smaller Text

The content of the <small>...</small> element is displayed one font size smaller than the rest of the text surrounding it.

Grouping Content

The <div> and <span> elements allow you to group together several elements to create sections or subsections of a page.

For example, you might want to put all of the footnotes on a page within a <div> element to indicate that all of the elements within that <div> element relate to the footnotes. You might then attach a style to this <div> element so that they appear using a special set of style rules.

The <span> element, on the other hand, can be used to group inline elements only. So, if you have a part of a sentence or paragraph which you want to group together.

⚠️ **GitHub.com Fallback** ⚠️