Problem Statement
Describe the basic structure of an HTML document.
Explanation
An HTML document has a clear structure. At the top is the DOCTYPE declaration specifying the HTML version. Next is the html tag, which wraps everything. Inside the html tag are two main sections.
The head section contains metadata that is not visible on the page. This includes the title tag for the browser tab, meta tags for encoding and descriptions, and links to stylesheets and scripts. The body section contains all visible content like headings, paragraphs, images, links, and forms. Users see and interact with everything in the body. The head always comes before the body. Both are required in valid HTML.
A basic document looks like this: DOCTYPE, then opening html tag, then head with title, then body with content, then closing html tag. This structure ensures your page works correctly in all browsers.
Code Solution
SolutionRead Only
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Basic HTML Structure</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Website Header</h1>
</header>
<main>
<p>Main content goes here</p>
</main>
<footer>
<p>Copyright 2025</p>
</footer>
</body>
</html>