HTML attributes provide additional information about HTML elements. Attributes are always specified in the start tag and usually come in name/value pairs like: name="value"
| Attribute | Description | Example |
|---|---|---|
| href | Specifies the URL for a link | <a href="url"> |
| src | Specifies the source file for an image | <img src="image.jpg"> |
| alt | Alternative text for an image | <img alt="description"> |
| width & height | Specifies dimensions | <img width="100" height="100"> |
| id | Unique identifier for an element | <div id="header"> |
| class | Specifies one or more class names | <p class="intro"> |
| style | Specifies inline CSS styles | <p style="color:red"> |
| title | Extra information (tooltip) | <p title="Tooltip"> |
The language of the document can be declared in the <html> tag. This is important for accessibility and search engines: