A simple HTML page needs a doctype, an <html> element with a language, a <head> holding metadata and a title, and a <body> holding the visible content. Save the markup in a file called index.html and open it in any browser to see it.
This tutorial builds a minimal, valid HTML5 page step by step and explains the purpose of every part.
Create a file named index.html with this content:
Double-click the file, or drag it into a browser window. You should see a large heading followed by a paragraph, and the tab shows the title "My First Page".
<!DOCTYPE html> must be the first line. It tells the browser to render the page in standards mode, following the current HTML living standard. Without it, browsers fall back to quirks mode, which imitates old browser behaviour and can change layout in confusing ways.
Older versions of HTML used long doctypes that referenced a DTD, such as the HTML 4.01 one. These are obsolete. Today you always write the short form, and it works for every modern browser.
The <html> element is the root that contains everything else on the page. Always set lang on it, for example lang="en". Screen readers use it to pick the right pronunciation, browsers use it for hyphenation and spell checking, and search engines use it as a language hint.
The <head> holds information about the page that is not displayed in the page body.
| Element | Purpose |
|---|---|
<meta charset="utf-8"> | Declares the character encoding. Keep it within the first 1024 bytes. |
<meta name="viewport" ...> | Makes the page scale correctly on phones. |
<title> | The page title in browser tabs, bookmarks and search results. |
<meta name="description" ...> | A short summary that search engines may show under the title. |
<link rel="stylesheet" ...> | Loads an external CSS file. |
Every page should have a unique, descriptive <title>. It is one of the strongest on-page signals for both users and search engines.
Everything the visitor sees goes inside <body>. Use elements that describe the meaning of the content:
Use one <h1> per page for the main heading, then <h2> and below in order. Text placed directly in the body without an element, as in many old examples, works in browsers but is poor structure, because it has no meaning for assistive technology.
.html extension.python3 -m http.server in that folder and visit http://localhost:8000.</p>, which can change how the rest of the page is parsed.lang and the viewport meta tag.<center> and <font>. Use CSS instead.Tag and attribute names are not case sensitive, but writing them in lowercase is the standard convention. File names and URLs on most servers are case sensitive.
Web servers return index.html by default when a visitor requests a folder, so https://example.com/ serves index.html from the root.
There are no numbered versions to choose from anymore. HTML is a living standard, and the single <!DOCTYPE html> line is correct for every current page.
The parser inserts them if you leave them out, but you should write them explicitly. It keeps the structure clear and lets you set lang.
A simple HTML page is a doctype, an <html lang> root, a <head> with charset, viewport and title, and a <body> with meaningful elements. Keep the markup valid, lowercase and semantic, and you have a solid base for CSS and JavaScript.