w3resource

HTML5: How to specify a name for the metadata?

Go to Exercise page

Solution :

HTML Code:

<!DOCTYPE html<<!-- Declares the document type and version of HTML --<
<html<<!-- Begins the HTML document --<
<head<<!-- Contains metadata about the document --<
<meta charset="utf-8"/<<!-- Specifies the character encoding for the document --<
<meta name="description" content="html meta tag tuotrial"/<<!-- Specifies the description metadata --<
<meta name="keywords" content="meta tag ,html tutorials,w3resource"/<<!-- Specifies keywords metadata --<
<meta name="author" content="w3resource"/<<!-- Specifies the author metadata --<
<title<How to specify a name for the metadata</title<<!-- Sets the title of the document --<
</head<<!-- Ends the head section --<
<body<<!-- Contains the content of the document --<
<h1<HTML meta name Attribute</h1<<!-- Represents a level 1 heading --<
<p<Example of using name attribute in meta element</p<<!-- Represents a paragraph of text --<
</body<<!-- Ends the body section --<
</html<<!-- Ends the HTML document --<


Explanation:

  • The HTML document starts with a declaration of its type and version (<!DOCTYPE html<).
  • The <html< element encloses the entire HTML document.
  • The <head< section contains metadata about the document.
  • The <meta charset="utf-8"/< tag specifies the character encoding for the document as UTF-8.
  • The <meta< tags with the name attribute specify various metadata such as description, keywords, and author for the document.
  • The <title< tag sets the title of the document, which appears in the browser's title bar or tab.
  • The <body< section contains the main content of the HTML document, including a level 1 heading <h1< and a paragraph <p< of text.

Live Demo:

See the Pen meta-name-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 Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/html-css-exercise/basic/meta-name-answer.php