HTML Essentials

Lesson 01 · 10 min

What a page is made of

Tag, attribute, nesting. You can't go further without them.

HTML describes structure, not appearance. The browser reads the tags and builds a tree: what's a heading, what's a paragraph, what's a link. CSS adds the style later, JavaScript the behavior. A page starts with a document, not with a chunk of markup in the middle of a file.

A minimal document

<!DOCTYPE html> tells the browser: this is modern HTML, not the old compatibility mode. Without it the page still opens, but some rules are calculated differently. html is the root. Inside it there are exactly two children: head (for the browser and search engines) and body (what a person sees).

AI

You can ask about this rule«A tag is brackets of meaning»

An attribute is a property of a tag

An attribute goes in the opening tag: a name and a value in quotes. href says where a link goes, alt says what's in the image if it can't be seen. The order of attributes doesn't matter. An unquoted value works only as long as it has no space in it — don't rely on that.

  • head — the tab title, the encoding, the description. None of it is on screen.
  • body — the visible content. Everything a person should see goes here.
  • Nesting reads like Russian dolls: a list inside nav, an item inside the list.
  • The browser collapses spaces and line breaks between tags. Format nicely for yourself, not for the output.
Close tags yourself, even if "it works anyway"

The browser closes an unclosed p before the next one. An unclosed li too. The page "works", but the tree is different, and styles and scripts end up in the wrong place. Write closing tags yourself, except for void ones. More about the document in MDN · Basic HTML syntax.

AI

You can ask about this point«Lesson summary»

Check

Lock it in before you move on

  1. 1. Why do you need the <!DOCTYPE html> line?

  2. 2. Where does the tab title go?

  3. 3. Which tag doesn't need closing?

  4. 4. Which nesting is correct?

PracticeSolve the lesson tasksA few short tasks in the editor. Check your code right away and see where it goes wrong.Start practice