Learn the basic building blocks of HTML, including HTML tags, elements,
attributes, document structure, VS Code setup, and how to create your first
SEO-friendly HTML page.
What Are HTML Basics?
HTML basics are the core concepts every beginner should understand before building
web pages. These include HTML tags, elements, attributes, headings, paragraphs,
links, images, lists, and the basic structure of an HTML document.
HTML gives content meaning and structure. CSS is used for styling, and JavaScript
is used for interactivity, but every website starts with HTML.
Tools Required to Write HTML
You do not need any paid software to learn HTML. A browser and a code editor are
enough to create and test your first web page.
Code Editor: Visual Studio Code
Browser: Chrome, Edge, Firefox, or Safari
File Extension:.html
How to Install VS Code for HTML
Visual Studio Code, also called VS Code, is one of the most popular code editors
for learning HTML, CSS, JavaScript, React, and modern frontend development.
Go to the official Visual Studio Code website.
Download VS Code for Windows, macOS, or Linux.
Install VS Code using the default setup options.
Open VS Code after installation.
Create a new folder for your HTML practice files.
Recommended VS Code Extensions:
Install Live Server, Prettier, and
HTML CSS Support to make HTML development easier.
How to Create Your First HTML File in VS Code
After installing VS Code, create your first HTML file and open it in the browser.
Open VS Code.
Create a new folder named html-basics.
Inside that folder, create a file named index.html.
Add the basic HTML code shown below.
Right-click the file and open it with Live Server or open it directly in a browser.
<!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>Welcome to HTML Basics</h1>
<p>This is my first HTML page created in VS Code.</p>
</body>
</html>
Basic HTML Document Structure
Every HTML page follows a basic structure. This structure helps browsers understand
the document correctly.
<!doctype html>: tells the browser this is an HTML5 document.
<html>: root element of the HTML page.
<head>: contains metadata, title, and SEO information.
<title>: displays the page title in the browser tab.
<body>: contains visible page content.
HTML Tags and Elements
HTML uses tags to create elements. An element usually has an opening tag, content,
and a closing tag.
<p>This is a paragraph.</p>
In this example, <p> is the opening tag,
This is a paragraph. is the content, and
</p> is the closing tag.
HTML Attributes
HTML attributes provide extra information about an element. Attributes are written
inside the opening tag.
In the first example, href defines the link destination.
In the second example, src defines the image path and
alt describes the image for accessibility and SEO.
Common HTML Tags for Beginners
Tag
Purpose
<h1> to <h6>
Creates headings
<p>
Creates paragraphs
<a>
Creates links
<img>
Displays images
<ul>, <ol>, <li>
Creates lists
<div>
Creates a generic container
<section>
Creates a meaningful page section
HTML Headings and Paragraphs Example
Headings create a clear page hierarchy. Paragraphs are used for readable text content.
<h1>HTML Basics</h1>
<h2>Learning HTML Tags</h2>
<p>HTML tags help structure web page content.</p>
For SEO, use only one main <h1> per page and organize subtopics
with <h2> and <h3>.
HTML Links and Images Example
Links help users move between pages, and images make content more useful and visual.
<a href="/tutorials/html/">Learn HTML Tutorial</a>
<img src="/images/html-example.png" alt="HTML code example for beginners" />
Always use descriptive link text and meaningful image alt text.
This improves both accessibility and search engine optimization.
HTML Basics for SEO
SEO-friendly HTML helps search engines understand your content better. Clean HTML
structure can improve crawlability, readability, and page relevance.
Use a unique and descriptive <title> tag.
Add a helpful meta description for each page.
Use heading tags in correct order.
Write descriptive image alt text.
Use semantic tags like <header>, <main>, and <footer>.
Use internal links to connect related tutorial pages.
<head>
<title>HTML Basics Tutorial for Beginners</title>
<meta
name="description"
content="Learn HTML basics with examples, tags, elements, attributes, and beginner best practices."
/>
</head>
HTML Basics for Accessibility
Accessible HTML helps people using screen readers, keyboards, and assistive tools.
Good accessibility also improves the overall quality of your website.