HTML Phrase Tags
HTML phrase tags are used to define the meaning or structure of a piece of text, providing semantic information about its content. These tags help browsers and search engines understand the purpose of the text, enhancing readability and accessibility.
Common HTML Phrase Tags:
Tag | Description | Example |
---|---|---|
<em> | Emphasizes text, usually displayed in italic. | <em>This is emphasized text.</em> |
<strong> | Indicates strong importance, usually displayed in bold. | <strong>This is strong text.</strong> |
<cite> | Used for titles of works, like books or movies, usually in italic. | <cite>The Great Gatsby</cite> |
<abbr> | Represents an abbreviation or acronym; often includes a title attribute. | <abbr title="Hypertext Markup Language">HTML</abbr> |
<code> | Represents computer code, typically in a monospaced font. | <code>print("Hello, World!")</code> |
<var> | Represents a variable in a mathematical expression or programming. | <var>x</var> = 5 |
<samp> | Represents sample output, such as from a program. | <samp>Error: File not found</samp> |
<kbd> | Represents user input, often displayed in monospaced font. | <kbd>Ctrl + S</kbd> |
<sub> | Displays text as subscript. | H<sub>2</sub>O |
<sup> | Displays text as superscript. | x<sup>2</sup> |
<mark> | Highlights text, usually with a yellow background. | <mark>Important text</mark> |
<del> | Indicates deleted text, usually displayed with a strikethrough. | <del>Old text</del> |
<ins> | Indicates inserted text, usually underlined. | <ins>New text</ins> |
Example of HTML Phrase Tags in Action:
<p><strong>HTML Phrase Tags</strong> add <em>semantic meaning</em> to text.</p>
<p>The book <cite>1984</cite> by George Orwell is a classic.</p>
<p>Shortcut: Press <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy.</p>
<p>The formula for water is H<sub>2</sub>O, and E=mc<sup>2</sup> is Einstein's equation.</p>
<p><mark>Highlighted text</mark> and <del>deleted text</del> show changes.</p>
Output:
- HTML Phrase Tags add semantic meaning to text.
- The book 1984 by George Orwell is a classic.
- Shortcut: Press
Ctrl
+C
to copy. - The formula for water is H₂O, and E=mc² is Einstein’s equation.
- Highlighted text and
deleted textshow changes.
These tags improve accessibility, maintain consistent formatting, and add meaning to our content!