HTML Basic

Beginner
10 min read
Updated: Nov 2026
6 examples
HTML tutorial

Definition and Usage

HTML (HyperText Markup Language) is the foundation of every web page. It uses tags to describe headings, paragraphs, links, images, and more so the browser knows how to structure content.

What is HTML in this tutorial?

This HTML tutorial starts with the smallest useful page: a doctype, an <html> root, <head> metadata, and a <body> with visible content. You will learn tags, elements, and attributes—the vocabulary you reuse on every later HTML page.

Why start an HTML tutorial with the basics?

CSS styles pages and JavaScript adds behavior, but both attach to HTML. If you understand the document skeleton and a handful of tags, you can already save a .html file, open it in a browser, and publish real content.

What will you build on this page?

A complete beginner page: headings, paragraphs, lists, a link, and proper charset / viewport metadata. Practice each piece in the Try It editor before moving on to HTML Editors.

Markup, not a program.

You do not compile HTML. Save a .html file and open it in any browser—no server required for local practice.

HTML + CSS + JavaScript.

Think of HTML as the skeleton, CSS as the look, and JavaScript as the behavior. This tutorial focuses on the skeleton first.

Learn structure before styling.

Do not pick heading levels for font size, or use div for everything. Match tags to meaning; style with CSS later.

HTML Document Syntax

Every HTML5 page follows this shape:

syntax.html
<!DOCTYPE html> <html> <head>…</head> <body>…</body> </html>
HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Page Title</title>
</head>
<body>
  <h1>This is a Heading</h1>
  <p>This is a paragraph.</p>
</body>
</html>

Most elements need an opening tag and a closing tag (<p>…</p>). Void elements like <img> and <br> have no closing tag and no inner content.

Core HTML Concepts

Ideas you will reuse throughout this HTML tutorial:

ConceptMeaning
<!DOCTYPE html>Declares an HTML5 document (always first line)
<html>Root element; use lang for accessibility and SEO
<head>Metadata browsers need (title, charset, stylesheets)—not page text
<body>Everything visitors see: text, images, links, and more
TagMarkup syntax such as <p> or </p>
ElementOpening tag + content + closing tag (or a void tag like <img>)
Attributename="value" on the opening tag (e.g. href, src, alt)

Tag vs element in HTML

TagElement
What it isThe <…> syntaxThe complete unit in the document
Example<p> and </p><p>Hello</p>
Attributes?Appear on the opening tagBelong to the whole element

Essential tags for beginners

TagRole in this tutorialTry it
<h1>–<h6>Page outline: one main title, then subsectionsTry it
<p>Paragraphs of textTry it
<ul> / <ol> / <li>Bullet or numbered listsTry it
<a>Hyperlinks with hrefTry it
<img>Images with src and altTry it
<div> / <span>Generic block vs inline wrappers (use sparingly)Try it

How to Write Your First HTML Page

A practical path through this HTML tutorial lesson:

  1. Create a file named index.html (or open the Try It editor below).
  2. Add <!DOCTYPE html>, then <html lang="en">.
  3. Fill <head> with charset, viewport, and a <title>.
  4. Put visible content in <body>: one <h1>, paragraphs, maybe a list.
  5. Add a link with <a href="…"> and an image with src + alt.
  6. Save, open in a browser, then refine. Next stop: HTML Editors.
GoalPattern
Page title (browser tab)<title>My First Page</title> inside head
Main heading<h1>Welcome</h1> once per page
Body text<p>…</p>
Bullet list<ul><li>…</li></ul>
Link<a href="https://example.com">Visit</a>
Image<img src="photo.jpg" alt="Description">

Live Preview

Switch between common beginner building blocks and see how the browser renders each one.

Pick a pattern from this HTML tutorial lesson. Source shape updates below the preview.

Rendered page

This is a Heading

This is a paragraph.

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

HTML Examples

Six examples from a minimal skeleton to a complete first page. Each includes View Output and Try It Yourself.

Example 1 — Minimal HTML5 Skeleton

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My First Page</title>
</head>
<body>
  <h1>This is a Heading</h1>
  <p>This is a paragraph.</p>
</body>
</html>
Try It Yourself

How It Works

  1. DOCTYPE puts the browser in HTML5 standards mode.
  2. head holds title and meta; visitors do not see that text on the page.
  3. body holds the heading and paragraph you see in the preview.
  4. Start here for every new file in this HTML tutorial.

Example 2 — Headings h1 and h2

HTML
<h1>Main Heading</h1>
<h2>Subheading</h2>
Try It Yourself

How It Works

  1. h1 is the main title of the page outline.
  2. h2 marks a subsection under that title.
  3. Size is default CSS—choose levels for meaning, not decoration.
  4. One h1 per page is the usual beginner habit.

Example 3 — Paragraph + ul List

HTML
<h1>My Favorite Things</h1>
<p>Here are a few things I enjoy:</p>
<ul>
  <li>Reading</li>
  <li>Coding</li>
  <li>Walking outdoors</li>
</ul>
Try It Yourself

How It Works

  1. p introduces the list in plain language.
  2. ul creates a bullet list; use ol for numbers.
  3. Each li is one list item.
  4. Nesting tags correctly keeps the outline clear.

Example 4 — div and span

HTML
<div>
  <p>This is a <span>block of content</span> inside a div.</p>
  <p>Spans wrap <span>inline text</span> without a line break.</p>
</div>
Try It Yourself

How It Works

  1. div groups block-level content (starts on a new line).
  2. span wraps part of a sentence inline.
  3. No meaning by themselves—prefer semantic tags when they fit.
  4. Later in CSS you will style these with classes.

Example 6 — My First Web Page

A complete beginner page combining everything from this HTML tutorial lesson:

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My First Web Page</title>
</head>
<body>
  <h1>Welcome to My Web Page</h1>
  <p>This is a basic HTML example.</p>

  <h2>Things I Like:</h2>
  <ul>
    <li>Coding</li>
    <li>Web Development</li>
    <li>Coffee</li>
  </ul>

  <p>Visit my <a href="https://example.com">website</a> for more information.</p>
</body>
</html>
Try It Yourself

How It Works

  1. Full skeleton with charset and viewport for real pages.
  2. Structured content with h1, h2, p, and ul.
  3. A link shows how navigation starts in HTML.
  4. Save as index.html and open it locally—you have a publishable page.

Edge Cases & Pitfalls

Beginner HTML tutorial mistakes that break layout, accessibility, or standards mode.

doctype

Missing <!DOCTYPE html>

Browsers may use quirks mode. Always put the doctype on the first line.

h1

Multiple h1 tags for styling

Use one main title; change size with CSS, not extra h1 elements.

close

Skipped closing tags

Always close normal elements like p, li, and a. Void tags are the exception.

alt

Images without alt

Meaningful images need descriptive alt. Screen readers and broken images rely on it.

div

div soup

Prefer header, main, nav, and footer when they match the content.

css

Presentation in HTML

Avoid inline color/font habits for learning. Structure with HTML; style with CSS in the next lessons.

Browser Support

Core HTML elements—headings, paragraphs, lists, links, and images—have been supported in every browser for decades. The HTML5 doctype and meta tags work in all modern browsers.

✓ Baseline · Widely available

Basic HTML elements

Every browser renders standard HTML tags the same way. You do not need polyfills for the fundamentals in this tutorial.

100% core tag support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
Basic HTML elements Universal

Bottom line: Write HTML once; it works in Chrome, Firefox, Safari, Edge, and mobile browsers.

Key Takeaways

  • HTML structures content; it is the first step of this HTML tutorial.
  • DOCTYPE + html + head + body is the document skeleton.
  • Tags, elements, attributes are the three words you will use constantly.
  • Practice with Try It, then continue to editors, tags, and attributes.

One line: Write a valid HTML5 skeleton, put meaningful tags in body, and open the file in a browser—that is your first web page.

Frequently Asked Questions

HTML (HyperText Markup Language) is the standard language for creating web pages. It uses tags to mark up content—headings, paragraphs, links, images—so browsers know how to display each part of the page.
No. HTML is a markup language—it describes structure and meaning, not logic. Programming languages like JavaScript or Python run instructions; HTML tells the browser what each piece of content is.
Start here on HTML Basic. Learn the document skeleton, a few tags, and attributes. Next, pick an editor, then explore tags, attributes, comments, and how to add CSS.
No. You can write HTML in any text editor and save the file with a .html extension. Dedicated code editors add syntax highlighting and preview, which makes learning easier—but they are optional.
A tag is the markup syntax, such as <p> or </p>. An element is the complete unit: opening tag, content, and closing tag—or a void tag like <img>. In everyday speech, people often use both words to mean the same thing.
It tells the browser this document follows the HTML5 standard. Always put it on the first line so the browser renders your page in standards mode instead of outdated compatibility quirks.
Save your file as something like index.html, then double-click it or drag it into a browser window. You can also use an editor with live preview, or this site’s Try It editor, then upload the file to a web host when you are ready to share it online.

Write your first HTML page

Open the Try It editor, edit the skeleton, and see your page render instantly.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful