The document type declaration (DOCTYPE) specifies the version of HTML that the document follows. It is placed at the beginning of an HTML document and helps browsers understand how to interpret the code.
<!DOCTYPE html>
<html>
<!-- HTML content goes here -->
</html>
The HTML element is the root element of an HTML document. It serves as the container that holds all other elements within the document. It indicates that the document is an HTML file and provides the structure for organizing content.
<!DOCTYPE html>
<html>
<!-- content goes here -->
</html>
The head element is used to define the metadata of an HTML document. It includes information such as the document's title, character encoding, links to external resources like CSS stylesheets, and other important data that isn't directly displayed on the webpage.
<head>
<title>My Webpage</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
The title element specifies the title of the HTML document, which appears in the browser's title bar or tab. It is crucial for search engine optimization (SEO) and helps users identify the page's content.
<head>
<title>My Awesome Website</title>
</head>
The body element contains the visible content of an HTML document, such as text, images, videos, and other elements. It represents the main content area of the webpage.
<body>
<h1>Welcome to my website!</h1>
<p>This is the main content of the page.</p>
</body>
An HTML document follows a specific structure with the DOCTYPE declaration, html element, head element, and body element. It organizes the content and provides essential information for browsers to render the webpage correctly.
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>