Suggest an editImprove this articleRefine the answer for “What is an attribute in HTML?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)An **attribute in HTML** is an additional parameter that supplements a tag and specifies its behavior, appearance, or content, giving the browser extra information about exactly how to display or process the element. **Key point:** an attribute is a "tag setting" that tells the browser where to get the data, how to show it, or how the element should behave.Shown above the full answer for quick recall.Answer (EN)ImageAn **attribute in HTML** is an additional parameter that **supplements a tag and specifies its behavior, appearance, or content**. It gives the browser *extra information* about exactly how to display or process the element. --- ### 1. The structure of an attribute An attribute is always written **inside the opening tag** and has the format: ```javascript name="value" ``` Example: ```html <a href="https://example.com" target="_blank">Go</a> ``` - `href` is the attribute name (specifies the link address) - `"https://example.com"` is the attribute value - `target="_blank"` is the second attribute; it opens the link in a new tab --- ### 2. Where attributes are used Almost every HTML tag can have attributes. They set **options** or provide **extra information**. Examples: ```html <img src="photo.jpg" alt="Photo"> <!-- the picture's path and description --> <input type="text" placeholder="Name"> <!-- the field's type and hint --> <button disabled>Submit</button> <!-- the button is disabled --> ``` --- ### 3. Types of attributes #### **Global (common)**: apply to all tags: | Attribute | Purpose | |---|---| | `id` | A unique identifier for the element | | `class` | A class name for CSS and JS | | `style` | Inline styling | | `title` | A tooltip on hover | | `hidden` | Hides the element | | `lang` | Specifies the language of the content | Example: ```html <p id="intro" class="text" title="Description">Example paragraph</p> ``` #### **Specific**: apply to particular tags: | Tag | Attributes | Purpose | |---|---|---| | `<a>` | `href`, `target` | The link and how it opens | | `<img>` | `src`, `alt`, `width`, `height` | The image and its parameters | | `<input>` | `type`, `value`, `placeholder` | An input field | | `<video>` | `controls`, `autoplay`, `loop` | Video controls | --- ### 4. Attributes with no value Some attributes act **simply by being present**, with no value specified: ```html <input type="checkbox" checked> <button disabled>Button</button> ``` Here `checked` and `disabled` mean the element is in an active state. --- ### Summary: | Property | Description | |---|---| | Where it's written | In the opening tag | | Format | `name="value"` | | Purpose | Specifies the element's properties | | Types | Global and specific | | With no value | Simply indicates a state (`checked`, `disabled`) | --- **In simple terms:** An attribute is a **"tag setting"** that tells the browser: *where to get the data, how to show it, or how the element should behave.*For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.