w3resource

HTML5: How to give the value associated with the http-equiv or name attribute?

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="content attribute example"/><!-- Provides a description of the document -->
<meta name="keywords" content="HTML, Tutorial, content attribute, meta"/><!-- Specifies keywords related to the document -->
<title>How to give the value associated with the http-equiv or name attribute</title><!-- Sets the title of the document -->
</head><!-- Ends the head section -->
<body><!-- Contains the content of the document -->
<p>This is an example of content attribute.</p><!-- Represents a paragraph of text -->
</body><!-- Ends the body section -->
</html><!-- Ends the HTML document -->

Explanation:

  • The HTML document begins 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, which supports a wide range of characters from various languages.
  • The <meta name="description" content="content attribute example"/> tag provides a brief description of the document's content.
  • The <meta name="keywords" content="HTML, Tutorial, content attribute, meta"/> tag specifies keywords related to the document, which may be used by search engines.
  • 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.
  • In this example, there is a paragraph <p> of text.

Live Demo:

See the Pen meta-content-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.



Follow us on Facebook and Twitter for latest update.