
HTML Text Formatting: Essential Tags and Examples
Table of Content:
- Table of content:
- The <b> Element
- Example
- Live Preview
- The <strong> Element
- Example
- Live Preview
- The <i> Element
- Example
- Live Preview
- The <em> Element
- Example
- Live Preview
- The <u> Element
- Example
- Live Preview
- The <s> and <strike> Element
- Example
- Live Preview
- The <tt> Element
- Example
- Live Preview
- The <sup> Element
- Example
- Live Preview
- HTML <sub> Element
- Example
- Live Preview
- HTML <big> Element
- Example
- Live Preview
- HTML <small> Element
- Example
- Live Preview
- HTML <hr> Element
- Example
- Live Preview
- HTML <mark> Element
- Example
- Live Preview
- HTML <del> Element
- Example
- Live Preview
- HTML <ins> Element
- Example
- Live Preview
- Related Questions
- Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.
If you use a word processor, you will be familiar with the ability to make text bold, italic, or underlined; these are just three of the ten options available to indicate how text can appear in HTML. The full list is bold, italic, monospaced, underlined, strikethrough, teletype, larger, smaller, superscripted, and subscripted text.
Table of content:
The <b>
Element
The HTML <b> element defines bold text, without any extra importance.
Anything that appears in a <b> element is displayed in bold, like the word bold here:
Example
<b>This text is bold</b>
Live Preview

The <strong>
Element
The contents of a <b>
element will be displayed in the same way as the contents of the
<strong>
element. You will meet the <strong>
element later; it is used
to indicate that its contents have strong emphasis.
Example
<strong>This text is strong</strong> <p>This text is inside paragraph</p>
Live Preview

The <i>
Element
The HTML <i>
element defines italic text, without any extra importance.
The content of an <i>
element is displayed in italicized text, like the word italic here:
Example
The following word uses an <i> italic</i> typeface.
Live Preview

The <em>
Element
The HTML <em>
element defines emphasized text, with added semantic importance.
The contents of an <i>
element will be displayed in the same way as the contents of the <em>
element.
You will meet the <em>
element later; it is used to indicate that its contents have emphasis.
Example
<em>This text is emphasized</em>
Live Preview

The <u>
Element
The content of a <u>
element is underlined with a simple line:
Example
The following word would be <u> underlined </u>
The <u>
element is deprecated, although it is still supported by current browsers.
Live Preview

The <s>
and <strike>
Element
The content of an <s>
or <strike>
element is displayed with a strikethrough, which is a thin line
through the text (<s>
is just the abbreviated form of <strike>
).
Example
The following word would have a <s> strikethrough </s>
Both the <s>
and <strike>
elements are deprecated, although they are still supported by current
browsers.
Live Preview

The <tt>
Element
The content of a <tt>
element is written in monospaced font (like that of a teletype machine)
Example
The following word will appear in a <tt> monospaced </tt> font
Live Preview

Now let's take a look at the <sup>
, <sub>
, <big>
,
<small>
, and <hr>
elements.
The <sup>
Element
The content of a <sup>
element is written in superscript; it is displayed half a character's height above
the other characters and is also often slightly smaller than the text surrounding it.
The HTML element defines superscripted text.
Example
<p>This is <sup>superscripted</sup> text.</p>
Live Preview

HTML <sub>
Element
The content of a <sub>
element is written in subscript; it is displayed half a character's height beneath
the other characters and is also often slightly smaller than the text surrounding it.
The HTML <sub>
element defines subscripted text.
Example
<p>This is <sub>subscripted</sub> text.</p>
Live Preview

HTML <big>
Element
When this element is used, it is possible to nest several <big>
elements inside one another, and the
content of each will get one size larger for each element.
Example
The following word should be <big> bigger </big> than those around it.
Live Preview

HTML <small>
Element
The HTML element defines smaller text:
The <small>
element is the opposite of the <small>
element, and its contents are displayed one font size
smaller than the rest of the text surrounding it. If the font is already the smallest, it has no effect. You can
nest several <small>
elements inside one another, and the content of each gets one size smaller for
each element.
Example
<h2 id="small">HTML <small>Small</small> Formatting</h2> The following word should be <small> smaller </small> than those around it
Live Preview

HTML <hr>
Element
The <hr>
element creates a horizontal rule across the page. It is an empty element, rather like the
<br>
element
Example
<hr>
This is frequently used to separate distinct sections of a page where a new heading is not appropriate.
Live Preview

HTML <mark>
Element
The HTML <mark>
element defines marked or highlighted text:
Example
<h2 id="mark">HTML <mark>Marked</mark> Formatting</h2>
Live Preview

HTML <del>
Element
The HTML element defines deleted (removed) text.
Example
<p>My favorite food is <del>pizza</del>.</p>
Live Preview

HTML <ins>
Element
The HTML element defines inserted (added) text.
Example
<p>My favorite food is <ins>pizza</ins>.</p>
Live Preview

- Question 1: How do you create multicolored text in a webpage?
- Question 2: Do style sheets limit the number of new style definitions that can be included within the brackets?
- Question 3: Can I specify fractional weight values such as 670 or 973 for font weight?
- Question 4: What is the hierarchy that is being followed when it comes to style sheets?
- Question 5: How to Wrap text in Html