Apollo Editor
Windows 10 & 11 Buy now · $69.95
HTML & CSS basics

HTML Basics for Beginners: The Tags and Structure You Actually Need

HTML basics explained simply: page structure, headings, paragraphs, links, images, lists and semantic tags, with short examples you can copy.

Updated 5 minute read The Apollo Editor team

HTML (HyperText Markup Language) is the code that describes what is on a web page: headings, paragraphs, links, images and lists. You write it as tags, such as <p> for a paragraph, that wrap around your content. A beginner only needs about a dozen tags and a simple page structure to build a real, working page.

This guide walks through the structure every page needs, the core tags you will use daily, how links and images work, and a few habits that keep your HTML clean from the start.

How HTML tags work

Most HTML is made of elements. An element usually has an opening tag, some content, and a closing tag with a slash.

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

Tags can also carry attributes, which add extra information. Attributes go inside the opening tag as name="value".

<a href="about.html">About us</a>

A few elements are "empty" and have no closing tag, because they have no content inside them. Images and line breaks are the common ones: <img src="logo.png" alt="Company logo"> and <br>.

Elements can sit inside other elements. This is called nesting. Always close the inner element before the outer one, so <p><strong>Hi</strong></p> is correct, while closing the paragraph first is not.

The basic structure of every page

Every HTML page follows the same skeleton. Here it is line by line:

  • <!DOCTYPE html>
  • <html lang="en">
  • <head>
  • <meta charset="utf-8">
  • <meta name="viewport" content="width=device-width, initial-scale=1">
  • <title>My first page</title>
  • </head>
  • <body>
  • <h1>Hello</h1>
  • <p>Welcome to my site.</p>
  • </body>
  • </html>

What each part does:

  • DOCTYPE tells the browser this is a modern HTML5 page.
  • html wraps everything. The lang attribute tells browsers and screen readers the page language.
  • head holds information about the page that is not shown in the page itself: the character set, the viewport setting for phones, the title in the browser tab, and links to stylesheets.
  • body holds everything visitors actually see.

Save the file with a .html extension, such as index.html, and open it in any browser to see it.

The core tags you will use most

You can build a surprising amount with just these.

TagWhat it is for
<h1> to <h6>Headings, from the main page heading down to minor subheadings
<p>A paragraph of text
<a>A link to another page, file, email address or section
<img>An image
<ul>, <ol>, <li>Bulleted lists, numbered lists and their items
<strong>, <em>Strong importance (usually bold) and emphasis (usually italic)
<div>A generic container for grouping content, usually for styling
<span>A generic inline container for a few words
<table>Rows and columns of data
<form>Inputs that collect information from visitors

Headings

Use one <h1> for the main topic of the page, then <h2> for sections and <h3> for subsections. Choose headings by their meaning, not their size. You can change the size later with CSS.

Lists

A bulleted list is a <ul> with one <li> per item:

  • <ul>
  • <li>Coffee</li>
  • <li>Tea</li>
  • </ul>

Swap <ul> for <ol> to get a numbered list.

Links use the href attribute to say where they go. A link to another page in your own site uses a relative path, like <a href="contact.html">Contact</a>. A link to another website uses the full address, starting with https://.

Images use src for the file location and alt for a text description:

<img src="images/team.jpg" alt="Our team outside the office" width="800" height="533">

The alt text is read aloud by screen readers and shown if the image fails to load, so always describe what matters in the picture. Setting width and height lets the browser reserve space so the page does not jump while loading. Our guides on adding links and inserting images go deeper.

Semantic tags that describe your layout

HTML5 added tags that describe the role of each part of a page. They behave like <div> but carry meaning, which helps screen readers and search engines understand your page.

  • <header> for the top of the page or a section, often with the logo.
  • <nav> for the main navigation links.
  • <main> for the main content (use it once per page).
  • <section> for a themed group of content with its own heading.
  • <article> for a self-contained piece, such as a blog post.
  • <aside> for related side content.
  • <footer> for the bottom of the page, with contact details or copyright.

Using these instead of a pile of plain <div> elements is one of the easiest ways to make a page more accessible.

Good habits from day one

  1. Keep content and style apart. HTML says what things are. CSS says how they look. Avoid old tags such as <font> and <center>.
  2. Indent nested elements. It makes mistakes like missing closing tags easy to spot.
  3. Use lowercase file names with no spaces, such as about-us.html. Web servers often treat upper and lower case differently.
  4. Validate your code. A validator catches unclosed tags and typos. The W3C Markup Validation Service is free.
  5. Look at real pages. Right-click a page in your browser and choose to view the source to see how others structure their HTML.

The easier way: learn HTML by watching it being written

One of the quickest ways to learn HTML is to format a page visually and watch the code appear. Apollo Editor is a Windows desktop HTML editor built around exactly that.

  • Split mode shows the page and its HTML side by side, kept in sync, so you can see which tags each change creates.
  • Code mode adds syntax highlighting, autocomplete, bracket matching and HTML validation with error highlighting.
  • An HTML element breadcrumb and element inspector show where you are in the page structure.
  • Page Properties sets the title, language, character encoding and viewport without hand-writing the head.

Your pages stay plain HTML you can open anywhere. When you are ready for styling, continue with CSS basics for beginners, or see the quick start.

Frequently asked questions

How long does it take to learn basic HTML?

The core tags can be learned in an afternoon. Getting comfortable with page structure and CSS takes a few weeks of practice.

What is the difference between HTML and CSS?

HTML describes the content and its structure. CSS controls how it looks, such as colors, fonts, spacing and layout.

Do I need special software to write HTML?

No. Any text editor works. An HTML editor adds helpful extras such as previews, syntax highlighting and validation.

Get three guides like this every month, plus software update notices.Subscribe →