HTML Text Formatting


Text formatting HTML elements

Element Description Example output
<b> Renders text in bold. <p>This is <b>bold</b> text.</p> This is bold text.
<strong> Indicates important text, often bold. <p>This is <strong>important</strong> text.</p> This is important text.
<i> Renders text in italics. <p>This is <i>italic</i> text.</p> This is italic text.
<em> Emphasizes text, typically in italics. <p>This is <em>emphasized</em> text.</p>

This is emphasized text.

;

<u> Underlines text. <p>This is <u>underlined</u> text.</p> This is underlined text.
<mark> Highlights text. <p>This is <mark>highlighted</mark> text.</p> This is highlighted text.
<small> Renders text in a smaller font size. <p>This is <small>smaller</small> text.</p>

This is smaller text.

;

<del> Strikes through text to indicate deletion. <p>This is <del>deleted</del> text.</p>

This is deleted text.

;

<ins> Underlines text to indicate insertion. <p>This is <ins>inserted</ins> text.</p> This is inserted text.
<sub> Renders text as subscript. <p>H<sub>2</sub>O is water.</p> H2O is water.
<sup> Renders text as superscript. <p>E = mc<sup>2</sup></p> E = mc2
<code> Displays text as computer code. <p>This is <code>code</code> text.</p> This is code text.
<pre> Preserves formatting including spaces and line breaks. <pre>This text\npreserves whitespace.</pre>
This text\npreserves whitespace.
<kbd> Renders text as user input (keyboard input). <p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p> Press Ctrl + C to copy.
<samp> Displays sample output or computer code. <p>Output: <samp>Error 404</samp></p> Output: Error 404
<var> Represents a variable in computer code or mathematics. <p>The variable is called <var>x</var>.</p> The variable is called x.
<cite> Represents the title of a work or a citation. <p><cite>Shakespeare</cite> is a famous writer.</p> Shakespeare is a famous writer.
<abbr> Defines an abbreviation or acronym. <p><abbr title=”HyperText Markup Language”>HTML</abbr> is a markup language.</p> HTML is a markup language.
<q> Indicates inline quotations. <p>He said, <q>To be or not to be</q>.</p> He said, To be or not to be.
<blockquote> Represents a block of quoted text. <blockquote><p>This is a longer quote.</p></blockquote>

This is a longer quote.

Scroll to Top