Lesson
02. HTML Document Structure
Every reliable web page begins with a consistent document structure. This structure tells the browser which HTML standard to use and separates page information from visible content.
The basic document
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My First Website</title>
</head>
<body>
<h1>Welcome</h1>
<p>My page is working.</p>
</body>
</html>
What each part does
<!doctype html>selects modern HTML.lang="en"identifies the page language for browsers and assistive technology.<head>contains metadata that is not part of the main page display.<body>contains the visible page content.- The viewport meta tag makes layouts work properly on mobile devices.
Practice activity
Replace your first file with the complete structure above. Change the title, heading, and paragraph, then refresh the browser to see your changes.
Knowledge check
Lesson quiz
Sign in to take this quiz and save your result.
Sign in to take quiz