CodeBlanks Logo Icon CodeBlanks

Summary - My first HTML page

HTML course · Beginner · Lesson 6/68

Combine the document skeleton, meta tags and comments to write your first full HTML page.

All pieces together

Combine what you have learned so far: the <!DOCTYPE html> declaration, the <html lang="..."> root, <head> with charset, viewport and title, <body> with visible content and optional comments.

All these pieces together form your first full HTML page. Now you will write it step by step.

Comments and indentation

Adding comments to your code reminds you what each section does. Using indentation visually separates nested tags. Both habits together improve readability.

Prefer short, concise notes over long comments. Keeping the same indentation measure across the page makes your code look tidy.

Exercise Write your first HTML page — the head

Add these three tags to the head of the given skeleton: <meta charset="utf-8">, <meta name="viewport" content="width=device-width, initial-scale=1"> and <title>My First Page</title>.

Show example solution
<!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>
  </body>
</html>

Exercise Add a comment to body

Add a short comment inside body; for example, note where the main content will go. Like <!-- Main content goes here -->.

Show example solution
<!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>
    <!-- Main content goes here -->
  </body>
</html>

Test yourself

  1. What does the viewport meta tag do?

    • It scales the page correctly on mobile screens
    • It sets the page's character encoding
    • It sets the tab title
    • It declares the document type
    Show answer

    It scales the page correctly on mobile screens — Correct. The viewport meta tag makes the page scale correctly on mobile screens.

  2. Close the title element

    <head>
      <meta charset="utf-8">
      <title>My First Page____
    </head>
    Show answer
    <head>
      <meta charset="utf-8">
      <title>My First Page</title>
    </head>

All lessons in Beginner