Skip to main content

News & Updates
🔓 Admissions Open! 📰 New Branch Opened in Gulshan Ravi Lahore 📰 New Branch Opened at Walton road Lahore 🔓 Admissions Open! 📰 New Branch Opened at Ferozpur Road Lahore 📰 New Branch Opened at PIA Road Lahore 🔓 Admissions Open!
HTML Fundamentals: Build Your First Web Page

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

Pass mark: 4/5