TutreNews Learn

Document structure

Elements, tags, attributes

Goal: Read and write elements with attributes and correct nesting · 7 min

HTML (HyperText Markup Language) describes the structure and meaning of content. It is built from elements. Most elements have an opening tag, content, and a closing tag:

<p>This is a paragraph.</p>

Attributes add information inside the opening tag as name="value" pairs: <a href="https://example.org" lang="en">. Some elements are void — they have no content and no closing tag, e.g. <img>, <br>, <input>, <meta>.

Elements nest like boxes: whatever opens last must close first. <p><strong>Hi</strong></p> is correct; <p><strong>Hi</p></strong> is not. HTML ignores extra spaces and line breaks in the source — indentation is for humans.

Worked example: Anatomy of an element

  1. Opening tag <a href="…"> with an attribute.
  2. Content: the clickable text, which contains a nested <em>.
  3. Closing tags in reverse order: </em> before </a>.
<p>Read the <a href="/guide"><em>beginner</em> guide</a>.</p>