If you’re starting web development, the first thing you need is to create and run your first HTML program in Visual Studio Code (VS Code).

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My First HTML Page</title>
</head>
<body>

    <h1>Hello World!</h1>
    <p>This is my first HTML program in VS Code.</p>

</body>
</html>
HTML Basic Structure Program

The <head> section contains information about the webpage, not visible directly on the page.

1. <!DOCTYPE html>

2. <html lang="en">

3. <head>

4. <meta charset="UTF-8">

5. <meta name="viewport" content="width=device-width, initial-scale=1.0">

After writing your HTML code, the next step is to run and view it in a web browser.

🔹 Method 1: Using Live Server (Recommended)

This is the best and most professional way to run HTML files in VS Code.

Steps:

▶️ Run Your File:

💡 What Happens?

Advantages of Live Server:

🔹 Method 2: Open Directly in Browser

This is the simplest method, good for beginners.

Steps:

💡 What Happens?

Quick Comparison

Feature

Live Server

Direct Browser

Auto Refresh

Yes

No

Speed

Fast

Normal

Beginner Friendly

Yes

Yes

Professional Use

Yes

No

File & Setup

Shortcut Key

Action

Ctrl + N

New File

Ctrl + S

Save File

Ctrl + O

Open File

Writing HTML Faster

Shortcut Key

Action

! + Enter

Generate full HTML structure

Ctrl + Space

Show suggestions

Editing & Formatting

Shortcut Key

Action

Ctrl + /

Comment / Uncomment

Shift + Alt + F

Format Code

Alt + ↑ / ↓

Move line up/down

Pro Tips