Kodokon kodokon.com

What is HTML? Tags and attributes

Discover what HTML is and learn to recognize a tag and an attribute.

6 min · 3 questions

Open this lesson in Kodokon

When you visit a website on your phone or computer, you are using a browser: the program that displays web pages (Chrome, Firefox, Safari...). To know what to display, the browser reads a document written in HTML. HTML stands for HyperText Markup Language. It is not a programming language: it does not compute anything. It is a description language that tells the browser what each piece of content is: "this is a heading", "this is a paragraph", "this is an image".

To describe content, HTML uses tags. A tag is a keyword placed between angle brackets < and >. Most tags work in pairs: an opening tag such as <p>, then the content, then a matching closing tag preceded by a slash: </p>. The whole "opening tag + content + closing tag" is called an element. The name p stands for paragraph.

HTML
<p>Hello!</p>
<p>This is my first paragraph.</p>
<p>The text goes between the two tags.</p>
Three p elements: every tag that is opened gets closed.

A tag can carry extra information called attributes. An attribute always goes inside the opening tag, never the closing one. It is written as name="value": the attribute name, an equals sign, then the value in double quotes. For example, the lang attribute states the language of the content, and the id attribute gives an element a unique identifier.

HTML
<p lang="fr">Un paragraphe écrit en français.</p>
<p lang="en">A paragraph written in English.</p>
<p id="conclusion">A paragraph with an identifier.</p>
The lang and id attributes, placed inside the opening tag.

Knowledge check

Make sure you remember the key points of this lesson.

  1. Fill in the opening tag to give this paragraph the identifier intro.
    <p ___>HTML</p>
    • id="intro"
    • id: "intro"
    • id("intro")
    • id["intro"]
  2. How do you write the closing tag of a paragraph?
    • <p>
    • </p>
    • <end-p>
  3. Where do you place an attribute such as lang="en"?
    • Inside the opening tag
    • Inside the closing tag
    • After the element, on a new line