Introduction HTML
HTML, short for HyperText Markup Language, is the language used to describe the structure and content of web pages. It tells the browser "this is a heading", "this is a paragraph", "this is a link to another page" or "show this image here". Every website you visit is built on HTML, with CSS adding the visual style and JavaScript adding behaviour. If you want to build anything for the web, HTML is where you start.
Markup, not programming
HTML is a markup language. It does not have variables, loops or calculations. Instead, you wrap pieces of content in tags that label what each piece is. The browser reads those labels and decides how to display the content. Because of this, HTML is quick to learn: within an hour you can create a real page and open it in a browser.
Elements, tags and attributes
An element usually consists of an opening tag, some content and a closing tag. For example, <p>Hello</p> is a paragraph element. The closing tag has a forward slash.
Attributes add extra information to an element and live inside the opening tag as name="value" pairs. In <a href="https://example.com">Visit</a>, the href attribute tells the link where to go. Images use src for the file and alt for a text description.
Some elements, called void elements, have no content and no closing tag. Common ones are <img>, <br>, <hr>, <input> and <meta>.
Your first complete page
Create a file called index.html, paste the following in, save it, and double-click to open it in a browser.
<!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, web!</h1>
<p>This is my first paragraph. HTML is <strong>fun</strong>.</p>
<img src="cat.jpg" alt="A ginger cat sleeping on a sofa">
<p>Find more on <a href="https://developer.mozilla.org">MDN</a>.</p>
</body>
</html>
Here is what each part does:
<!DOCTYPE html>tells the browser to use modern standards mode.<html>wraps the whole document;lang="en"declares the language.<head>holds information about the page, such as its title and character encoding, which is not shown in the page body.<body>holds everything visitors actually see.
Elements live inside each other
HTML forms a tree. The <html> element contains <head> and <body>, the body contains headings and paragraphs, and a paragraph can contain <strong> or a link. This tree is what JavaScript later works with through the DOM, so clean nesting pays off down the road.
Early mistakes and how browsers react
Browsers are forgiving. If you forget a closing tag or nest elements wrongly, they guess what you meant and still show something. That sounds helpful, but it means errors go unnoticed until the layout looks odd or CSS does not apply. A classic example is overlapping tags like <strong><em>text</strong></em>. Tags must close in the reverse order they opened: <strong><em>text</em></strong>.
Another early habit to build is choosing elements by meaning, not appearance. Use <h1> for the main heading because it is the main heading, not because you want big text; CSS will handle the size. Running your page through the W3C validator is a quick way to catch mistakes.
What you now know
HTML labels content with elements, adds details with attributes, and arranges everything in a nested tree with a head and a body. With a text editor and a browser, you already have every tool needed to start building pages.
Ready to master real-world web development?
Learn HTML, CSS3, Bootstrap and JavaScript hands-on with mentor-led sessions.