W3C Designer

html phrase tags

7/02/2021
Hacker

The HTML phrase tags are special purpose tags, which defines the structural meaning of a block of text or semantics of text.

phrase tag indicates that a block of text has structural meaning.

Phrase tags are used for special purpose like to display text in the middle of the paragraph.


phrase tags in html

list of HTML phrase tags

HTML supports various phrase tags. Following is the list of html phrase tags, some of which we have already discussed in our HTML formatting chapter.

  • Abbreviation tag : <abbr>
  • Acronym tag: <acronym>
  • Marked tag: <mark>
  • Strong tag: <strong>
  • Emphasized tag : <em>
  • Definition tag: <dfn>
  • Quoting tag: <blockquote>
  • Short quote tag : <q>
  • <code> and <pre>
  • Keyboard tag: <kbd>
  • Address tag: <address>
  • Text Direction: <bdo>
  • Text Citations: <cite>
  • Program Output: <samp>
  • variable tag: <var>

Abbreviation tag

<abbr> tag is used for text abbreviation.

The content written between <abbr> and </abbr> tag will show dots in text bottom on browser.

This tag is used to shorten the text. To collapse text, type text between the <abbr> and </abbr> tags.

This is useful when you want to shorten a word or phrase and give extra full information to the visitors in short.

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Text Abbreviation</title>
  5. </head>
  6. <body>
  7. <p>This site is <abbr title = "W3Code Designer">W3C Designer</abbr>.</p>
  8. </body>
  9. </html>

This will produce the following result −

Output

This site is W3C Designer.


Acronym tag

acronym term is used for acronym tag.

The <abbreviation> tag is not supported in HTML5. <acronym> tag used to define an acronym. An acronym that is used to pronounce another word.

Creating acronyms will provide useful information to browsers, translation systems, and search engines. The title attribute will display the full version of the acronym when the mouse is hovered over it.

<abbr> is a replacement for <abbreviation> in HTML5.

Its output is same as abbreviation tag (<abbr>) Because this is older of abbreviation tag.

Syntax - <acronym>.. text here.. </acronym>

Example -

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> acronym example</title>
  5. </head>
  6. <body>
  7. <p><acronym title="TutorialsCampus">TC</acronym> is a best online library in the world</p>
  8. </body>
  9. </html>

Output -

w3cdesigner is a best Computer Programming Platform in the world


Marked tag

<mark> tag is used for marked tag. The <mark> tag was introduced in HTML 5. Marked tag is used to display the text as highlighted text in html.

The content written between <mark> and </mark> tag will show as yellow mark on browser.

This tag is used to highlight a particular text.

Syntax - <mark>.. text here.. </mark>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Marked Text Example</title>
  5. </head>
  6. <body>
  7. <p>The following word has been <mark>marked</mark> with yellow</p>
  8. </body>
  9. </html>

Output

The following word has been marked with yellow

Any text in between <mark>..</mark> displays as highlighted text. It means text background is yellow But, its text color is black default.


Strong tag

This tag is used to display the important text of the content. The text written between <strong> and </strong> will be displayed as bolder text.

strong tag is same as bold tag

Strong Tag is used for making the appearance of a word strong or bolder for giving more importance.

The <strong> tag used to represent the strong importance, seriousness or urgency of its contents.

Syntax - <strong>.. text here.. </strong>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Strong text example.. </title>
  5. </head>
  6. <body>
  7. <p>This is <strong>Strong </strong>text</p>
  8. </body>
  9. </html>

output

This is Strong text


Emphasis Tag

It is same as italic tag.

Emphasized text is used to display the text as in emphasized text, with added semantic importance. Emphasized text uses <em> tag. <em> is also called as pharse tag.

This tag is used to emphasize the text, and displayed the text in italic form. The text written between and tag will italicized the text.

Syntax - <em>.. text here.. </em>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Emphasized text example.. </title>
  5. </head>
  6. <body>
  7. <p>This is <em> Emphasized </em> text</p>
  8. </body>
  9. </html>

Output

This is Emphasized text


Definition tag

The <dfn>....</dfn> HTML Definition Element allows to specify that we are introducing a especial term in web page. It's usage is similar to italic words in the midst of a paragraph.

Definition tag specify the term is special term for browser.

Used to defining instance of a term. The <dfn> tag used to represent the defining instance of term. The tag can be represented like <dfn></dfn> with the term inserted between the opening and closing tags.

This is used when HTML user introduce a especial term and display it differently on webpage.

Syntax - <dfn>.. text here.. </dfn>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Special Terms Example</title>
  5. </head>
  6. <body>
  7. <p>The following word is a <dfn>special</dfn> term.</p>
  8. </body>
  9. </html>

Output

The following word is a special term.


Quoting tag

Quoting tags are used when HTML developers want to add quot to passages from a different source.

When you want to quote a passage from another source, you should place it in the middle of <blockquote>...</blockquote> tags.

Syntax - <blockquote>.. text here.. </blockquote>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Blockquote Example</title>
  5. </head>
  6. <body>
  7. <p>The following description of XHTML is taken from the W3C Web site:</p>
  8. <blockquote>W3C - Html Phrase Tags.</blockquote>
  9. </body>
  10. </html>

Output

The following description of XHTML is taken from the W3C Web site:

W3C - Html Phrase Tags.

Short Quotations tag

Short Quote Tag is used for adding a double quote to your statement on your web page.

The <q>...</q> element is used when you want to add a double quote within a sentence.

it will enclose the text in double quotes that means the content written between <q> will show on double quots in Browser screen.

Syntax - <q>.. text here.. </q>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Double Quote Example</title>
  5. </head>
  6. <body>
  7. <p>Amit is in Spain, <q>I think I am wrong</q>.</p>
  8. </body>
  9. </html>

Output

You are in W3Code Designer.


Code tags

The HTML <code> </code> element is used to display the part of computer code. It will display the content in monospaced font.

Used to define the computer code. Code formatting is used to define the programming code. Code formatting uses <code> tag. Any text in between <code>..</code> defines it as programming code to browsers.

Syntax - <code>.. code here.. </code>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> Code formatting element example.. </title>
  5. </head>
  6. <body>
  7. <code>Var a = b + c</code>
  8. </body>
  9. </html>

Output

Var a = b + c

Pre tag

The <pre> tag defines preformatted text.

Text inside a <pre> element is visibled in a fixed-width font, and the text preserves both line breaks and spaces. The text will be displayed exactly as written in the HTML source code.

This will show output as you write content such as it display spaces, line breaks and so more.

Syntax - <pre>.. text here.. </pre>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Strong text example.. </title>
  5. </head>
  6. <body>
  7. <pre> Text inside pre element is visibled in a fixed-width font, and it preserves both line breaks and spaces. </pre>
  8. </body>
  9. </html>

Output

Text inside pre element
is visibled in a fixed-width
font, and it preserves
both line breaks and spaces.

Keyboard Tag

Keyboard formatting is used to define the keyboard input. Keyboard input means the input/text entered by the user in any means.

Defaultly its background color is black.

Keyboard formatting uses <kbd> tag. Any text in between <kbd>..</kbd> defines it as keyboard input to browsers. <kbd> element is nested element.

At that time, you can use the keyboard tag when asking readers to enter some text.

Syntax - <kbd>.. text here.. </kbd>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> Keyboard formatting element example.. </title>
  5. </head>
  6. <body>
  7. <p><kbd> File > Open > type > save</kbd></p>
  8. </body>
  9. </html>

Output

File > Open > type > save


Address tag

An HTML <address> tag defines the contact information about the author of the content. The content written middle of <address> and </address> tag, will be displayed in italic font .

Address Tags are used for specifying as well as emphasize which group of text is an address.

Syntax - <address>..content text here.. </address>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Address Example</title>
  5. </head>
  6. <body>
  7. <address>388A, Road No 22, Jubilee Hills - Hyderabad</address>
  8. </body>
  9. </html>

Output

388A, Road No 22, Jubilee Hills - Madhya Pradesh

Text Direction

BDO stands for Bi-Directional Override.

The <bdo> tag is used to override the current text direction.

Syntax - <bdo>.. text here.. </bdo>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Text Direction Example</title>
  5. </head>
  6. <body>
  7. <p>This text will go left to right.</p>
  8. <p><bdo dir = "rtl">This text will go right to left.</bdo></p>
  9. </body>
  10. </html>

Output

This text will go left to right.

This text will go right to left.


Text Citations

The <cite> tag defines the title of a creative work example as a book, a poem, a painting and a sculpture, and so more.

Text in the <cite> element usually renders in italic.

Syntax - <cite>.. text here.. </cite>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Strong text example.. </title>
  5. </head>
  6. <body>
  7. <p><cite>The Scream</cite> by Edward Munch. Painted in 1893.</p>
  8. </body>
  9. </html>

Output

The Scream by Edward Munch. Painted in 1893.


Program Output

The <samp> tag is used to define sample output from a computer program. The content inside is displayed in the browser's default monospace font.

Syntax - <samp>.. text here.. </samp>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Program Output Example</title>
  5. </head>
  6. <body>
  7. <p>Result produced by the program is <samp>Hello World!</samp></p>
  8. </body>
  9. </html>

Output

Result produced by the program is Hello World!


Var tag

Any text in between <var>..</var> defines it as mathematical variable to browsers. <var> element is nested element. Mostly <var> used in mathematical expressions.

Defines a variable or Variable formatting in HTML document. Variable formatting is used to define the mathematical variable. Variable formatting uses <var> tag.

Syntax - <var>.. text here.. </var>

Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Sample formatting element example..</title>
  5. </head>
  6. <body>
  7. <var>a = b * c</var>
  8. </body>
  9. </html>

Output

a = b * c

1 comment:

  1. Best explanation of html phrase tags for beginners.
    I like your content w3code designer.
    You have explained everything about html phrase tags in your website w3 code designer.

    Thank you w3codedesigner.

    ReplyDelete