Suggest an editImprove this articleRefine the answer for “What is a tag in HTML?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **tag in HTML** is a building block of a web page, used to tell the browser exactly what to display and what role that element plays. **Key point:** a tag is a "command for the browser" that describes the structure and meaning of the content.Shown above the full answer for quick recall.Answer (EN)ImageA **tag in HTML** is a **building block** of a web page, used to tell the browser **exactly what to display** and **what role that element plays**. In simpler terms: > A tag is a **command for the browser** that describes the structure and meaning of the content. --- ### What a tag looks like A tag is a word enclosed in angle brackets `< >`. Most tags have an **opening** and a **closing** form: ```html <p>This is a paragraph of text.</p> ``` - `<p>` is the **opening tag** (start of the element). - `</p>` is the **closing tag** (end of the element). - Everything between them is the **content**. --- ### An example with several tags: ```html <h1>Page heading</h1> <p>Text below the heading.</p> <a href="https://example.com">Link</a> <img src="photo.jpg" alt="Photo"> ``` Here: - `<h1>` is a heading, - `<p>` is a paragraph, - `<a>` is a link, - `<img>` is an image. --- ### Types of tags 1. **Paired** tags have an opening and a closing tag: ```html <div>Content</div> <p>Text</p> ``` 2. **Single (self-closing)** tags do not contain text inside and do not require closing: ```html <img src="photo.jpg" alt="Photo"> <br> <hr> ``` --- ### Tag attributes Tags can have **attributes**: additional parameters that refine their behavior. They are written **inside the opening tag**. Example: ```html <a href="https://example.com" target="_blank">Go</a> ``` Here: - `href` is the link address, - `target="_blank"` opens it in a new tab. --- ### How the browser understands tags The browser **does not display the tags themselves**, only **interprets them**: - `<h1>` makes the text a large heading, - `<p>` adds spacing between paragraphs, - `<img>` inserts a picture, and so on. --- ### Summary: | Term | Meaning | |---|---| | **Tag** | A command for the browser indicating which element to create | | **Opening tag** | The start of an element (`<p>`) | | **Closing tag** | The end of an element (`</p>`) | | **Attribute** | An additional property of a tag (`src`, `href`, `alt`) | | **Element** | Everything together: tag + content + attributes | --- **In simple terms:** A tag is a **"label"** that HTML uses to mark every piece of the page: where the heading is, where the text is, where the image is, and what to do with it. Without tags, the browser would not understand how to assemble a page from plain text.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.