HTML Phrase tag
HTML Phrase Tags Tutorial by CodesWithPankaj
In HTML, phrase tags are used to add meaning and emphasis to specific parts of text content. Unlike regular text formatting tags, phrase tags convey semantic meaning to both users and search engines. Let’s go over each phrase tag, how it’s used, and how it can enhance your HTML documents.
1. <em>
Tag – Emphasis
<em>
Tag – EmphasisThe <em>
tag emphasizes text by making it italic. It adds semantic importance to the text, signaling to both users and search engines that this text is stressed or emphasized.
Example:
2. <strong>
Tag – Strong Emphasis
<strong>
Tag – Strong EmphasisThe <strong>
tag makes text bold and conveys that the content is of high importance or seriousness. This is often used for critical information.
Example:
3. <small>
Tag – Fine Print
<small>
Tag – Fine PrintThe <small>
tag reduces the size of the text, often used for disclaimers or footnotes.
Example:
4. <mark>
Tag – Highlighted Text
<mark>
Tag – Highlighted TextThe <mark>
tag highlights text as if with a marker, useful for drawing attention to new or updated content.
Example:
5. <abbr>
Tag – Abbreviations
<abbr>
Tag – AbbreviationsThe <abbr>
tag represents an abbreviation or acronym. When using this tag, you can add a title
attribute to provide the full form when users hover over it.
Example:
6. <cite>
Tag – Citations
<cite>
Tag – CitationsThe <cite>
tag is used to reference the title of a work (like books, movies, or research papers). This text is usually italicized by default.
Example:
7. <dfn>
Tag – Definitions
<dfn>
Tag – DefinitionsThe <dfn>
tag marks the first instance of a term being defined in a document. It indicates that the following text is a term definition.
Example:
8. <q>
Tag – Inline Quotes
<q>
Tag – Inline QuotesThe <q>
tag is used for inline quotations, automatically adding quotation marks around the quoted text.
Example:
9. <code>
Tag – Code Snippets
<code>
Tag – Code SnippetsThe <code>
tag is used to display code in a monospace font. This tag helps identify computer code.
Example:
10. <samp>
Tag – Sample Output
<samp>
Tag – Sample OutputThe <samp>
tag is used to represent sample output from a program or command.
Example:
11. <kbd>
Tag – Keyboard Input
<kbd>
Tag – Keyboard InputThe <kbd>
tag indicates text to be entered by the user. It displays the text in a monospace font.
Example:
12. <var>
Tag – Variables
<var>
Tag – VariablesThe <var>
tag is used to define a variable in a mathematical expression or programming context.
Example:
Full Example of HTML Document Using Phrase Tags
Here’s an example HTML document showing all the phrase tags in action:
Summary
This guide covers the primary HTML phrase tags, allowing you to add meaningful emphasis and structure to your text. Use these tags to improve readability and convey specific meanings to users and search engines. Practice using each tag to get familiar with how they impact your HTML content. Happy coding with CodesWithPankaj!
Last updated