Your First HTML Page
What Is It?
An HTML page is a text file saved with the .html extension.
What the Tags Mean
<!DOCTYPE html>: tells the browser this is modern HTML.head: holds page information.body: holds what people see.
Example 1
Save each example as index.html and open it in your browser. Each code block is a complete page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My page</title>
</head>
<body>
<h1>Hello!</h1>
<p>This is my first page.</p>
</body>
</html>Browser preview
What you see: The tab says “My page”. The page shows “Hello!” and a paragraph.
Example 2: Another Use
This second complete page uses the same structure for a page about yourself.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your First HTML Page</title>
</head>
<body>
<h1>About me</h1>
<p>My name is Asha.</p>
</body>
</html>Browser preview
Simple Tip
The title appears in the browser tab. The h1 appears on the page.
Try It Yourself
Change the title and the heading to different words.