agyanadda@gmail.com

HTML Document Structure

HTML Basics 1 min read Updated Nov 30, 2026 Topic 1 of 33

Every HTML page follows the same basic structure. Learn it once and you can start any web page.

The parts of a page

  • <!DOCTYPE html> tells the browser this is a modern HTML5 page.
  • <html lang="en"> wraps the whole page. The lang attribute helps search engines and screen readers.
  • <head> holds information about the page: the title, character set and links to CSS files. It is not shown on the page.
  • <body> holds everything the visitor sees: headings, text, images, links and forms.

Always add these two lines in the head

  • <meta charset="UTF-8"> so Hindi, symbols and emojis display correctly.
  • <meta name="viewport" content="width=device-width, initial-scale=1"> so the page looks right on mobile phones.

Tip: Save this structure as a template file and start every new page from it.

Example

Example — A complete HTML page HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My First Page</title>
</head>
<body>
  <h1>Hello, World!</h1>
  <p>This is my first web page.</p>
</body>
</html>

The title appears in the browser tab; the heading and paragraph appear on the page.

Try it Now »

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which element holds the content visitors see?

Exercise 2 True / False

The <head> section is displayed on the page.

Exercise 3 Fill in the Blank

Complete the first line of an HTML5 page: <!___ html>

Frequently Asked Questions

Yes. Without it, browsers switch to "quirks mode" and may show your page differently. Always start with <!DOCTYPE html>.

It makes the page fit the width of the phone screen instead of showing a tiny desktop version.