w3resource

HTML5: How to define information about the document?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html><!-- Opening tag for declaring the document type -->
<html><!-- Opening tag for the root element of the HTML document -->
<head><!-- Opening tag for the document's header section -->
<meta charset="utf-8"><!-- Metadata tag specifying the character encoding of the document -->
<title>html head</title><!-- Title of the HTML document -->
</head><!-- Closing tag for the document's header section -->
<body><!-- Opening tag for the document's body section -->
<p>We are learning HTML head element.</p><!-- Paragraph element containing text content -->
</body><!-- Closing tag for the document's body section -->
</html><!-- Closing tag for the root element of the HTML document -->

Explanation:

  • This HTML code represents a basic HTML document structure.
  • The <!DOCTYPE html> declaration specifies the document type and version of HTML being used.
  • The <html> element is the root element of the HTML document and contains all other HTML elements.
  • The <head> element contains meta-information about the HTML document, such as the character encoding and the title.
  • Inside the <head> element, the <meta> element specifies the character encoding of the document.
  • The <title> element sets the title of the HTML document, which appears in the browser's title bar or tab.
  • The <body> element contains the visible content of the HTML document, such as text, images, and other elements.
  • Inside the <body> element, there is a <p> (paragraph) element containing text content.

Live Demo:

See the Pen head-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
YesYesYesYesYes

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://www.w3resource.com/html-css-exercise/basic/head-answer.php