HTML 5 has interesting features that make designing HTML web pages simpler using minimal writing of code. It provides a rich set of interesting tags to design web elements. One such tag is useful, which is known as tag. This tag is used to define and display an abbreviation in the one go. The HTML abbr tag will allow us to define the full form of abbreviations or acronyms, and the browser will display the short-form version of letters normally on a web page, but upon hovering over those abbreviations, the browser will display the full form of that acronym automatically.
The tag is generally used along with the
<abbr> PFA </abbr>
This will only display simple text without any meaning. Suppose we want to use assign full form for the above abbreviation, i.e. PFA, then
<abbr title = "Please Find Attached" > PFA </abbr>
Here, we have defined the display title as short-form, but at the same time, we have defined the full form of it using the tag along with the
Attributes: As we have seen in the syntax, the title tag, when used along with the tag, becomes an attribute and assigns special functionality to it. Otherwise, there are no more specific tags available to use with the tag, but this tag supports the global attributes and event attributes that are available by default in HTML.
Below are the examples of implementing the HTML abbr tag:
In this example, we can see the Simple abbr without a Title Tag.
Code:
<!DOCTYPE html> <html> <head> <title> abbr tag in HTML </title> <style> body { text-align: left ; } </style> </head> <body> <abbr > PFA </abbr> </body> </html>
Output: will be a simple text as below,
In this example, we can see the abbr With a Title Tag.
Code:
abbr tag in HTML <abbr title = "Please Find Attached" > PFA </abbr>
Output: will be an acronym with a dotted underline.
If we try to hover over this, it will display the title that we have given in a similar way to the tooltip.
Here, we have used the CSS styling element font style as italic over the tag.
Code:
abbr tag in HTML while writing an email, generally <abbr title = "Please Find Attached" > PFA </abbr> is used
Output:
Let’s use some more CSS styling elements over tag.
Code:
abbr tag in HTML while writing an email, generally <abbr title = "Please Find Attached" > PFA </abbr> is used
Output:
Here, we have made our acronym as bold and red using the CSS styling elements.
Let’s modify the same example to add more styling and designing.
Code:
abbr tag in HTML while writing an email, generally <abbr title = "Please Find Attached" > PFA </abbr> is used
Output:
In each of the examples above, try to hover above the acronym we have used, i.e. PFA, and see how the browser will display the title we have assigned to it.
So, we have seen the tag, which is introduced in HTML 5. This tag provided the way to define the abbreviations or acronyms and display their titles or detailed information in one go. We have seen multiple examples of attribute. There are no such special attributes available with this tag.
The above is the detailed content of HTML abbr Tag. For more information, please follow other related articles on the PHP Chinese website!