HTML5: How to define the root of an HTML document?
Solution:
HTML Code:
Explanation:
- This HTML code represents a basic HTML document structure with the root <html> element.
- The <!DOCTYPE html> declaration specifies the document type as HTML5.
- The <html> element is the root element of the HTML document, containing all other HTML elements.
- Inside the <html> element, there are two main sections: <head> and <body>.
- The <head> element contains meta-information about the HTML document, such as the character encoding and the title.
- Inside the <head> element, there is a <meta> tag specifying the character encoding of the document and a <title> tag defining the title of the HTML document.
- 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 solution in the browser
Supported browser
![]() |
![]() |
![]() |
![]() |
![]() |
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.