First HTML Program


Now that you understand the basics of HTML and the tools required, it is time to write your first HTML program.

This lesson will guide you step by step to create a simple web page and view it in a browser.

Steps to Create Your First HTML File

1. Open a text editor such as Notepad or VS Code
2. Create a new file
3. Save the file with a .html extension
4. Write the HTML code
5. Open the file in a web browser
 

This code creates a simple HTML page with a heading and a paragraph.

  1. The document type declaration ensures the browser uses modern HTML standards.
  2. The title appears in the browser tab.
  3. The content inside the body is displayed on the webpage.

Saving and Running the HTML File

After writing the code, save the file with a name like index.html.

Double-click the file or open it using a browser such as Chrome or Firefox. The browser will display your HTML page.

Common Beginner Mistakes

  • Forgetting to save the file with .html extension
  • Writing code outside the body tag
  • Missing opening or closing tags
  • Opening the file in a text editor instead of a browser

Why This Step Is Important

Writing your first HTML program builds confidence and removes fear of coding.

Every professional web developer started with a simple HTML page like this.

Practice Task

Try changing the heading text and paragraph content. Save the file and refresh the browser to see the changes.

What You Will Learn Next

In the next lesson, you will learn about common HTML mistakes beginners make and how to avoid them while coding.