HTML Attribute Reference

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.

AttributeBelongs toDescription
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
classGlobalSpecifies one or more class names
cols<textarea>Specifies visible width
colspan<td>, <th>Merges multiple columns
content<meta>Specifies metadata value
contenteditableGlobalMakes element editable
controls<audio>, <video>Displays media controls
data-*GlobalStores custom data
defer<script>Delays script execution
dirGlobalSpecifies text direction
disabled<input>, <button>, <select>Disables element
download<a>Forces file download
draggableGlobalSpecifies whether element is draggable
enctype<form>Specifies form encoding type
for<label>Associates label with input
height<img>, <video>, <canvas>Specifies height
hiddenGlobalHides element
href<a>, <link>Specifies hyperlink destination
idGlobalSpecifies unique id
langGlobalSpecifies 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
styleGlobalAdds inline CSS
tabindexGlobalSpecifies tab order
target<a>, <form>Specifies where to open result
titleGlobalTooltip information
type<input>, <button>, <script>Specifies input or script type
value<input>, <option>, <button>Specifies value
width<img>, <video>, <canvas>Specifies width

Leave a Comment