An HTML document has a basic structure consisting of several key elements:
<!DOCTYPE html>
: Declares the document type as HTML5.<html>
: The root element that contains the entire HTML document.<head>
: Contains meta-information about the document, such as the title, character encoding, and links to external resources (e.g., CSS, JavaScript).<body>
: Contains the visible content of the page, such as text, images, and other elements.
Example of a simple HTML document:
<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Sample HTML Document</title>
</head>
<body>
<h1>Welcome to My Webpage</h1>
<p>This is a simple HTML document example.</p>
</body>
</html>