Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 122 ยท Getting Started

What Is HTML?

A beginner-friendly introduction to HTML. Learn what HTML does, how browsers read it, and write your very first lines of markup.

Welcome! Every page you have ever visited on the web, whether it was a news article, a shop, a recipe or a search result, reached your browser as a plain text file written in HTML. HTML stands for HyperText Markup Language, and it is the first language every web developer learns.

This course takes you from zero to building complete, accessible web pages. You do not need to install anything to start: every lesson has live editors where you can change the code and see the result instantly. In this first lesson you will find out what HTML actually is, what happens when you open a web page, how an HTML element is put together, and you will write your first lines of markup.

Markup, not programming

HTML is a markup language. Instead of giving the computer step-by-step instructions (that is what programming languages such as JavaScript or Python do), HTML labels pieces of content so the browser knows what each piece is.

Think of a printed recipe. Even without reading a word, you can spot the title, the list of ingredients and the numbered steps, because each part is laid out differently. HTML gives a web page that same kind of structure, but in a way a computer can understand:

  • "This text is the main heading."
  • "These lines form a list."
  • "This word is a link to another page."
  • "Show a picture here."

The browser reads those labels and decides how to display everything on screen. Because HTML only describes, it has no variables, loops or calculations. That makes it much easier to learn than a programming language, but it does not make it less important. Getting the labels right is what makes a page readable, searchable and usable by everyone.

Your first taste of HTML

Labels in HTML are called tags. A tag is a word wrapped in angle brackets, such as <h1> or <p>. Most tags come in pairs: an opening tag before the content and a closing tag, with a forward slash, after it.

Edit the example below. Change the words between the tags and watch the result update.

Your first HTML
  • <h1> โ€ฆ </h1> marks a heading, the most important title on the page.
  • <p> โ€ฆ </p> marks a paragraph of ordinary text.

Notice that the tags themselves never appear on the page. They are instructions for the browser, not content for the reader.

Anatomy of an element

A pair of tags plus everything between them is called an element. You will hear the words "tag" and "element" used loosely, but there is a difference worth knowing from day one:

HTML
<a href="/html/links">Read about links</a>
  • <a href="/html/links"> is the opening tag. It holds the element's name, a (an anchor, or link).
  • href="/html/links" is an attribute: extra information written inside the opening tag as name="value". Here it says where the link goes.
  • Read about links is the content, the part the reader sees.
  • </a> is the closing tag. The slash tells the browser this element ends here.
  • The whole thing, from < to the final >, is the element.

A few elements, such as <img> for images and <br> for line breaks, have no content and therefore no closing tag. They are called void elements. You will meet them in Elements, and attributes get a full lesson in Attributes.

Elements can also go inside other elements. That is called nesting, and it is how every page is built: a paragraph can contain a link, a list contains list items, and the whole page sits inside one <html> element.

Elements inside elements

Look at how each element gives the browser a different instruction. <strong> marks words as important, so they appear bold. <ul> starts a bulleted list and each <li> is one item in it. <a> turns text into a link. Try adding a fourth <li> to the list, or wrap another word in <strong>.

What happens when you open a web page

When you type an address into your browser, a short conversation takes place:

  1. Your browser looks up the site's name (such as example.com) to find the address of the server, a computer somewhere on the internet that stores the site.
  2. It sends that server a request: "Please send me this page."
  3. The server sends back a response: a text file full of HTML.
  4. The browser reads the file from top to bottom. Whenever the HTML mentions another file, such as an image, a stylesheet or a script, the browser requests that file too.
  5. The browser builds the page from all those pieces and renders it, which means drawing it on your screen.

The address itself is called a URL, and it tells the browser which server to ask and which file to request. You will learn how URLs and paths fit together in File Paths.

What a browser actually does

A browser is far more than a window that shows pictures. When it receives HTML it does a lot of work for you:

  • Parses the text, which means reading the tags and figuring out which elements exist and how they are nested.
  • Builds a tree of those elements in memory, called the Document Object Model. JavaScript can later read and change that tree, as you will see in The Document Object Model.
  • Applies styles, both its own defaults (headings are big and bold, links are blue and underlined) and any CSS you provide.
  • Lays out and paints the page, working out where every box goes for the current screen size.
  • Exposes the page to assistive technology, such as screen readers, so people who cannot see the screen can still use it.

Every major browser follows the same official specification, the HTML Living Standard, so a well-written page works the same in Chrome, Firefox, Safari and Edge.

The browser is also very forgiving. If you forget a closing tag, it will usually guess what you meant and carry on rather than show an error. That is friendly for beginners, but it also means mistakes can hide quietly. One more reason to learn to write HTML carefully from the start.

The browser repairs mistakes

The missing </p> tags cause no harm, because the browser knows a new paragraph ends the old one. The missing </strong>, however, makes the bold spill further than intended. Add </strong> after "bold text" and see how the result changes. The lesson: the browser guesses, but the guess is not always what you wanted.

HTTP in a nutshell

The conversation between browser and server follows a set of rules called HTTP, the Hypertext Transfer Protocol. (HTML is the Hypertext Markup Language: the "hypertext" in both names means text with links to other texts.) HTTP is the delivery truck; HTML is one of the things it carries, next to images, stylesheets and scripts.

An HTTP request is plain text. This is roughly what a browser sends:

HTTP
GET /courses/html HTTP/1.1
Host: www.example.com
Accept: text/html
Accept-Language: en

And the server answers with a status line, some headers and then the body, which for a web page is the HTML:

HTTP
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: max-age=3600

<!doctype html>
<html lang="en">
  ...
  • Methods say what the browser wants to do. GET fetches something, POST sends data (for example a form), and others such as PUT and DELETE are used by apps and APIs.
  • Status codes summarize the result: 200 means success, 301 and 302 redirect to another address, 404 means the page was not found, and 500 means the server broke. Codes starting with 4 are the client's mistake, codes starting with 5 are the server's.
  • Headers carry extra facts: the type of the content, how long it may be cached, the language the visitor prefers.
  • HTTP is stateless. Each request stands alone, and the server does not remember the previous one. Sites add memory with cookies, which the browser sends back with later requests.
  • HTTPS is HTTP wrapped in encryption, so nobody on the way can read or change the traffic. Use it for every site.

You can see real requests in your browser's Network panel, covered in DevTools.

Strengths and limits of HTML

HTML's strengths explain why it has lasted more than thirty years: it is free and open, it is plain text that any editor can write, it runs on every device with a browser, it is forgiving of mistakes, and it connects to CSS and JavaScript cleanly. It supports text, images, audio, video, forms, graphics and links without plug-ins.

It also has limits. HTML describes structure and content only: it has no real logic of its own (loops, calculations, saving data), so interactive features need JavaScript and a server. Its look depends on CSS. Pages are static unless a script or server changes them. And because browsers fix mistakes silently, broken markup can go unnoticed until it behaves differently somewhere else, which is why validating your code is worth the minute it takes.

HTML, CSS and JavaScript

Modern websites are built from three languages that each have one job:

Language Job Analogy
HTML Structure and meaning The walls and rooms of a house
CSS Appearance and layout Paint, furniture, lighting
JavaScript Behavior and interaction Electricity, doors that open

You can build a working page with HTML alone, and that is exactly where this course begins. CSS and JavaScript are added on top later, and both depend on a solid HTML foundation. If the HTML says "this is a navigation menu" or "this is a form field with a label", CSS can style it reliably and JavaScript can find it easily.

Tip: You can peek at the HTML of almost any website. Right-click a page and choose View page source. Real-world pages are long and busy, but you will start recognizing tags very soon. Viewing Source and Using DevTools shows you how to explore pages like a professional.

Why learning HTML well is worth it

  • Everything on the web uses it. Frameworks, content management systems and site builders all produce HTML in the end. Knowing it lets you fix what those tools get wrong.
  • Search engines read it. Clear structure helps your pages get found and shown with the right title and description.
  • Accessibility depends on it. Screen readers rely on correct HTML to describe a page to people who cannot see it. A real <button> works with a keyboard for free; a styled box pretending to be a button does not.
  • It is quick to learn. A handful of tags will take you surprisingly far, and every new one builds on the same simple pattern.

A common beginner mistake is to choose tags by how they look, for example using a heading just to get big text. Always choose a tag by what the content is. If you want it to look different, that is a job for CSS.

What you'll be able to build

This course is organized in chapters that build on each other. Here are a few highlights of where you are heading:

  • Text, links and lists. You will structure articles with headings and paragraphs, connect pages with links and organize information with lists and tables.
  • Images and media. You will add images, video and audio that adapt to every screen.
  • Page structure. You will give your pages a clear outline with semantic elements such as header, navigation, main content and footer.
  • Forms. You will collect input with forms, from simple sign-ups to multi-field checkouts with built-in validation.
  • Interactive pieces. You will build disclosures, dialogs and popovers that need little or no JavaScript.
  • Real projects. You will put it all together in projects such as a personal landing page and a contact form.

By the end, you will be able to write clean, modern, accessible HTML for real websites, and read anyone else's with confidence.

How to use these lessons: read a section, then play with the live editor below it. Break things on purpose. Delete a closing tag, misspell an element name, swap two lines. Seeing what goes wrong is one of the fastest ways to learn. You can always reload the page to get the original example back.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What kind of language is HTML?

    HTML describes structure and meaning. Instructions and logic are JavaScript's job, and appearance is CSS's job.
  2. 2. In <p>Hello</p>, what does the reader actually see on the page?

    Tags are instructions for the browser and are never displayed. Only the content between them appears.
  3. 3. In <a href="/about">About us</a>, what is href="/about"?

    An attribute adds extra information inside the opening tag, written as name="value". The content is "About us".
  4. 4. Which language would you use to make a button react when someone clicks it?

    HTML creates the button and CSS styles it, but behavior such as reacting to clicks comes from JavaScript.
  5. 5. What happens when a browser meets a small mistake, such as a missing closing tag?

    Browsers are forgiving and repair many errors silently, which is exactly why careful habits matter: the guess isn't always what you intended.

Summary

  • HTML is a markup language that describes the structure and meaning of web content.
  • Content is labeled with tags such as <h1> and <p>; an opening tag, content and a closing tag together form an element, and attributes add extra information.
  • Elements nest inside each other to build the whole page.
  • Browsers request HTML from a server, parse it into a tree, style it and render it, repairing small mistakes as they go.
  • HTML handles structure, CSS handles appearance and JavaScript handles behavior.

Next: A Short History of HTML, where you'll see how the language grew from one physicist's idea into the living standard every browser follows today.