HTML Introduction
Start your web development journey by learning what HTML is and how to create your first web page from scratch.
What is HTML?
HTML (HyperText Markup Language) is the standard language for the structure and content of web pages. It uses tags like <h1>, <p>, <a> and <img> to mark up headings, paragraphs, links and images, and the browser reads those tags to display the page. CSS then styles the page and JavaScript adds behaviour.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My first page</title>
</head>
<body>
<h1>Hello, world!</h1>
<p>This is my first web page.</p>
</body>
</html>Your First HTML Page
Try editing this HTML code to see how it works. This is a complete, working web page!
Code Editor
<h1>My first web page</h1>
<p>HTML describes <strong>what</strong> is on the page.</p>
<ul>
<li>Headings</li>
<li>Paragraphs</li>
<li><a href="https://www.compileum.com">Links</a></li>
</ul>
<img src="https://picsum.photos/id/1/200/120" alt="A laptop on a desk" width="200" height="120">Preview
How HTML Works
HTML (HyperText Markup Language) is the standard markup language for creating web pages. It describes the structure and content of a webpage using elements and tags.
Markup Language
Not a programming language - it's markup that structures content
Web Foundation
Every website you visit is built with HTML as its foundation
Works with CSS & JS
Combined with CSS for styling and JavaScript for interactivity
Key Points About HTML:
- HTML uses tags to mark up content and define structure
- Browsers read HTML and render it as formatted web pages
- HTML creates the hierarchical structure called the DOM
- It's platform-independent and works on all devices
Understanding HTML Structure
Let's break down how HTML works by examining the structure of an HTML document:
Code Editor
<!DOCTYPE html>
<html lang="en">
<head>
<!-- This is the HEAD section - not visible to users -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Understanding HTML Structure</title>
<style>
/* CSS can go in the head */
body { font-family: Arial, sans-serif; }
</style>
</head>
<body>
<!-- This is the BODY section - visible to users -->
<!-- HTML uses tags with angle brackets -->
<h1>HTML Document Structure</h1>
<!-- Tags usually come in pairs: opening and closing -->
<p>This paragraph explains how HTML works.</p>
<!-- Some tags are self-closing -->
<img src="example.jpg" alt="Example image">
<br>
<!-- Tags can have attributes -->
<a href="https://www.example.com" target="_blank">
This link opens in a new window
</a>
<!-- Tags can be nested inside other tags -->
<div class="container">
<h2>Nested Content</h2>
<p>This paragraph is <strong>inside</strong> a div element.</p>
</div>
</body>
</html>Preview
Document Structure:
DOCTYPE
Tells the browser this is HTML5
HTML Element
Root container for all content
Head Section
Metadata not visible to users
Body Section
All visible content goes here
HTML Elements:
Tags
Enclosed in angle brackets: <tag>
Elements
Complete structures with opening/closing tags
Attributes
Additional information: class="value"
Content
Text and other elements between tags
What You Need to Get Started
The beauty of HTML is its simplicity. You need very little to start creating web pages:
Text Editor
Any text editor works, but VS Code, Sublime Text, or Atom provide helpful features
Web Browser
Any modern browser (Chrome, Firefox, Safari, Edge) to view your pages
Basic Skills
Ability to create and save text files - that's it!
Quick Start Tips:
- 1.Create a new file and save it with a .html extension
- 2.Copy the first example from this tutorial into your file
- 3.Double-click the file to open it in your browser
- 4.Start experimenting and making changes!
HTML Best Practices
Do This:
- Use lowercase for all tag names and attributes
- Always close your tags properly
- Use semantic elements that describe content meaning
- Indent nested elements for better readability
- Include alt text for images
Avoid This:
- Leaving tags unclosed or improperly nested
- Using deprecated elements like <font> or <center>
- Choosing elements based on appearance instead of meaning
- Forgetting the DOCTYPE declaration
- Using excessive inline styles instead of CSS
HTML Introduction — step by step
Understand what HTML is
HTML (HyperText Markup Language) is the skeleton of every webpage. It defines the structure and meaning of content using elements and tags.
🎯 Quick Check
What does HTML stand for?
HTML Introduction: summary
Key points
- HTML is a markup language, not a programming language: it describes content rather than running logic.
- Most elements have an opening tag, content and a closing tag:
<p>Text</p>. A few, like<img>and<br>, are void elements with no closing tag. - Attributes add information to elements, for example
<a href="/about">or<img alt="…">. - HTML files are plain text saved with a
.htmlextension and opened directly in a browser.
Frequently asked questions
›Is HTML a programming language?
No. HTML is a markup language: it structures content but has no variables, loops or logic. For behaviour you use JavaScript.
›What is the latest version of HTML?
HTML is now a "living standard" maintained by WHATWG and updated continuously. "HTML5" is the common name for modern HTML.
›How long does it take to learn HTML?
The core elements can be learned in a few days. Writing good semantic, accessible HTML takes a few weeks of building real pages.