How to Write Your First HTML Page
HTML (HyperText Markup Language) is the foundation of every web page. It tells browsers how to structure and display content — headings, paragraphs, images, links, and more. This guide walks you through writing your first HTML page from scratch, and previewing it in real time.
The basic structure
Every HTML page follows the same skeleton. Here are the essential parts:
<!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>Hello, world!</h1>
<p>This is my first web page.</p>
</body>
</html>Try pasting this into the editor to see it rendered instantly.
Essential tags to know
<h1>to<h6>— headings, from largest to smallest<p>— paragraphs of text<a href="...">— links to other pages<img src="..." alt="...">— images<ul>and<ol>— unordered and ordered lists<div>and<span>— generic containers for layout and styling
Adding styles inline
You can add CSS directly to elements using the style attribute. This is a quick way to experiment with colors, fonts, and spacing:
<h1 style="color: navy; font-family: sans-serif;">
Welcome to my site
</h1>
<p style="color: gray; line-height: 1.6;">
This paragraph has custom styling.
</p>Try it yourself
The best way to learn HTML is to write it and see what happens. Open HTML Viewer Cat, paste the examples above, and start experimenting. Change the text, add new tags, break things on purpose — that's how you learn.