Attributes give HTML elements extra information, such as where a link goes or which image to show. The video (in Hindi) covers the most common ones; here is a quick reference.
How attributes are written
<a href="https://example.com" class="btn">Visit</a>
Attributes go inside the opening tag, as name="value" pairs, separated by spaces.
Common attributes
| Attribute | Used on | What it does |
|---|---|---|
| href | a, link | The address a link points to |
| src | img, script, iframe | The file to load |
| alt | img | Text describing the image, for screen readers and search engines |
| id | any | A unique name for one element |
| class | any | A reusable name for styling groups of elements |
| style | any | Inline CSS for one element |
| placeholder | input, textarea | Hint text shown in an empty field |
| title | any | Extra information shown on hover |
| target | a | Where to open the link, such as a new tab |
Tips
- Always quote attribute values.
- Each id must be unique on the page; classes can repeat.
- Prefer classes and a stylesheet over inline style attributes.
- Encode special characters in URLs; our URL encoder does it for you.
- Small images can be embedded directly in src with our image to Base64 tool.
Want the full picture? This article is part of Business websites: the complete guide, our in-depth guide with everything in one place.




