HTML

Emphasized Text


In HTML, you can emphasize text using several different tags, depending on the type of emphasis you need. Here are the most common tags for emphasizing text:

 

Italic Text (<i> and <em>):

  • <i>: This tag is used for text that is set off from the normal prose, such as a technical term, a phrase from another language, or a thought.
<p>This is <i>italic</i> text.</p>
  • <em>: This tag is used to emphasize text, typically displayed in italic. It has a semantic meaning, indicating that the content should be emphasized.
<p>This is <em>emphasized</em> text.</p>

 

Bold Text (<b> and <strong>):

  • <b>: This tag is used for text that is stylistically different from normal text, without conveying any extra importance.
<p>This is <b>bold</b> text.</p>
  • <strong>: This tag is used to indicate that the content is of strong importance, typically displayed in bold.
<p>This is <strong>strongly emphasized</strong> text.</p>

 

Underline Text (<u>):

  • <u>: This tag is used to underline text, often indicating a misspelling or for styling purposes.
<p>This is <u>underlined</u> text.</p>

 

Strikethrough Text (<s>):

  • <s>: This tag is used for text that is no longer accurate or relevant.
<p>This is <s>strikethrough</s> text.</p>

 

Monospaced Text (<code>, <pre>, <kbd>):

  • <code>: This tag is used to define a piece of computer code.
<p>This is <code>inline code</code> text.</p>
  • <pre>: This tag is used to define preformatted text, maintaining both spaces and line breaks.
<pre>This is preformatted text.</pre>
  • <kbd>: This tag is used to represent user input, usually displayed in a monospaced font.
<p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p>

 

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Text Emphasis in HTML</title>
</head>
<body>
    <p>This is <i>italic</i> text.</p>
    <p>This is <em>emphasized</em> text.</p>
    <p>This is <b>bold</b> text.</p>
    <p>This is <strong>strongly emphasized</strong> text.</p>
    <p>This is <u>underlined</u> text.</p>
    <p>This is <s>strikethrough</s> text.</p>
    <p>This is <code>inline code</code> text.</p>
    <pre>
This is preformatted text.
It preserves spaces and line breaks.
    </pre>
    <p>Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p>
</body>
</html>