Learn one of the most powerful programming languages in the world and become a rockstar developer.
HTML provides several tags that you can use to make some text on your web pages to appear differently than normal text, for example, you can use the tag
<b> to make the text bold, tag
<i> to make the text italic, tag
<mark> to highlight the text, tag
<code> to display a fragment of computer code, tags
<del> for marking editorial insertions and deletions, and more.
The following example demonstrates the most commonly used formatting tags in action. Now, let's try this out to understand how these tags basically work:
In the previous chapter, you learned about the HTML style attribute.
HTML also defines special elements for defining text with a special meaning.
HTML uses elements like
<i> for formatting output, like bold or italic text.
Formatting elements were designed to display special types of text:
<b>- Bold text
<strong>- Important text
<i>- Italic text
<em>- Emphasized text
<mark>- Marked text
<small>- Small text
<del>- Deleted text
<ins>- Inserted text
<sub>- Subscript text
<sup>- Superscript text
<p>This is <b>bold text</b>.</p> <p>This is <strong>strongly important text</strong>.</p> <p>This is <i>italic text</i>.</p> <p>This is <em>emphasized text</em>.</p> <p>This is <mark>highlighted text</mark>.</p> <p>This is <code>computer code</code>.</p> <p>This is <small>smaller text</small>.</p> <p>This is <sub>subscript</sub> and <sup>superscript</sup> text.</p> <p>This is <del>deleted text</del>.</p> <p>This is <ins>inserted text</ins>.</p>
By default, the
<strong> tag is typically rendered in the browser as
<b>, whereas the
<em> tag is rendered as
<i>. However, there is a difference in the meaning of these tags.
<b> tags render the enclosed text in a bold typeface by default, but the
<strong> tag indicates that its contents have strong importance, whereas the
<b> tag is simply used to draw the reader's attention without conveying any special importance.
<p>This is <b>bold text</b>.</p> <p>This is <strong>strongly important text</strong>.</p>
<i> tags render the enclosed text in italic type by default, but the
<em> tag indicates that its contents have stressed emphasis compared to surrounding text, whereas the
<i>tag is used for marking up text that is set off from the normal text for readability reasons, such as a technical term, an idiomatic phrase from another language, a thought, etc.
<p>This is <i>italic text</i>.</p> <p>This is <em>emphasized text</em>.</p>
You can easily format the quotation blocks from other sources with the HTML
Blockquotes are generally displayed with indented left and right margins, along with a little extra space added above and below. Let's try an example to see how it works:
<blockquote> <p>Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning.</p> <cite>— Albert Einstein</cite> </blockquote>
An abbreviation is a shortened form of a word, phrase, or name.
You can use the
<abbr> tag to denote an abbreviation. The
title attribute is used inside this tag to provide the full expansion of the abbreviation, which is displayed by the browsers as a tooltip when the mouse cursor is hovered over the element. Let's try out an example:
<p>The <abbr title="World Wide Web Consortium">W3C</abbr> is the main international standards organization for the <abbr title="World Wide Web">WWW or W3</abbr>. It was was founded by Tim Berners-Lee.</p>