This page provides a structured reference of commonly used HTML attributes along with the elements they belong to and their descriptions. HTML attributes add extra information to elements and control how they behave, appear, or function on a webpage.
Each attribute is written inside the opening tag and usually follows the format name=”value”. This reference table helps beginners and developers quickly understand where an attribute is used and what it does.
| Attribute | Belongs to | Description |
|---|---|---|
accept | <input> | Specifies types of files the server accepts |
action | <form> | Specifies where to send form data |
alt | <img> | Alternative text for image |
async | <script> | Loads script asynchronously |
autocomplete | <form>, <input> | Enables or disables autocomplete |
autofocus | <input>, <textarea> | Automatically focuses element on page load |
autoplay | <audio>, <video> | Starts media automatically |
checked | <input> | Pre-selects checkbox or radio button |
class | Global | Specifies one or more class names |
cols | <textarea> | Specifies visible width |
colspan | <td>, <th> | Merges multiple columns |
content | <meta> | Specifies metadata value |
contenteditable | Global | Makes element editable |
controls | <audio>, <video> | Displays media controls |
data-* | Global | Stores custom data |
defer | <script> | Delays script execution |
dir | Global | Specifies text direction |
disabled | <input>, <button>, <select> | Disables element |
download | <a> | Forces file download |
draggable | Global | Specifies whether element is draggable |
enctype | <form> | Specifies form encoding type |
for | <label> | Associates label with input |
height | <img>, <video>, <canvas> | Specifies height |
hidden | Global | Hides element |
href | <a>, <link> | Specifies hyperlink destination |
id | Global | Specifies unique id |
lang | Global | Specifies language |
list | <input> | Links input to datalist |
loop | <audio>, <video> | Repeats media |
max | <input> | Maximum value |
maxlength | <input>, <textarea> | Maximum number of characters |
method | <form> | Specifies HTTP method |
min | <input> | Minimum value |
multiple | <input>, <select> | Allows multiple values |
muted | <audio>, <video> | Mutes media |
name | <input>, <form> | Specifies element name |
pattern | <input> | Validation pattern |
placeholder | <input>, <textarea> | Hint text inside input |
readonly | <input>, <textarea> | Makes input read-only |
rel | <a>, <link> | Specifies relationship |
required | <input>, <select> | Makes field mandatory |
rows | <textarea> | Specifies visible rows |
rowspan | <td>, <th> | Merges multiple rows |
selected | <option> | Pre-selects option |
src | <img>, <script>, <audio>, <video> | Specifies file source |
step | <input> | Specifies step interval |
style | Global | Adds inline CSS |
tabindex | Global | Specifies tab order |
target | <a>, <form> | Specifies where to open result |
title | Global | Tooltip information |
type | <input>, <button>, <script> | Specifies input or script type |
value | <input>, <option>, <button> | Specifies value |
width | <img>, <video>, <canvas> | Specifies width |