w3resource

HTML5: How to author an abbreviation or an acronym?

Go To Address page

Solution :

HTML Code :

<!-- Declare the document type as HTML5 -->
<!DOCTYPE html>

<!-- Start the HTML document -->
<html>

<!-- Start the head section containing metadata about the document -->
<head>

<!-- Set the character encoding to UTF-8 -->
<meta charset="utf-8">

<!-- Set the title of the document -->
<title>How to author an abbreviation or an acronym?</title>

<!-- Close the head section -->
</head>

<!-- Start the body section containing the content of the document -->
<body>

<!-- Create an abbreviation (abbr) with the title attribute providing the full expansion -->
<abbr title="Uniform Resource Locator">URL</abbr> stand for Uniform Resource Locator 

<!-- Close the body section -->
</body>

<!-- Close the HTML document -->
</html>

Explanation:

The above HTML code defines a basic HTML5 document with metadata in the head section and a body containing an abbreviation element (<abbr>) for "URL," along with an explanation of its full expansion.

Here's a brief explanation of each part of HTML code:

  • <!DOCTYPE html>: Declares the document type as HTML5.
  • <html>: Marks the beginning of the HTML document.
  • <head>: Contains metadata about the document, such as character encoding and the title.
  • <meta charset="utf-8">: Sets the character encoding to UTF-8.
  • <title>How to author an abbreviation or an acronym?</title>: Sets the HTML document title.
  • </head>: Closes the head section.
  • <body>: Contains the actual HTML document content.
  • <abbr title="Uniform Resource Locator">URL</abbr> stand for Uniform Resource Locator: Creates an abbreviation (<abbr>) with the title attribute providing the full expansion ("Uniform Resource Locator"). The abbreviation "URL" is then used in the text, followed by an explanation.
  • </body>: Closes the body section.
  • </html>: Marks the end of the HTML document.

Live Demo :

See the Pen abbr-tag-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes Yes

Go To Home page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.