Definition
The <html>
HTML element is the root element of an HTML document. It wraps all the other elements of the webpage and defines the document type and language.
Here’s an example of how the <html>
element is used:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>My Webpage</title>
</head>
<body>
<!-- Content of the webpage goes here -->
</body>
</html>
In this example, the <html>
element wraps all the other elements of the webpage. The lang
attribute in the opening <html>
tag specifies the language of the document, which can help with accessibility and search engine optimization.
The <html>
element contains two main sections: the <head>
and <body>
. The <head>
section includes metadata about the document, such as the character encoding (<meta charset="UTF-8">
) and the title of the webpage (<title>
). The <body>
section contains the visible content of the webpage, including text, images, links, and other HTML elements.
It’s important to include a valid <!DOCTYPE html>
declaration at the beginning of the document to indicate that the document follows the HTML5 standard.
The <html>
element acts as the root of the HTML document and serves as the starting point for structuring the webpage. It provides a container for all the other elements and sets the overall structure and properties of the document.