HTML - Attribute Reference



To customize an element's behavior, special term called HTML attributes are utilized inside the opening tag. An HTML element type can be modified via HTML attributes. An attribute either changes an element type default functionality or adds functionality to some element type that wouldn't work properly without it.

Local Attributes

Following are the local attributes that are listed below −

Sr.No Attribute & Description
1

accept

The HTML accept attribute is used to describe what file type the user should be allowed to select from a file input dialog box.

2

accept-charset

The HTML accept-charset attribute is used to specify the character encodings that are to be used for the form submission.

3

action

The HTML action attribute is used to specify a URL that processes the form submission.

4

align

The alignment of content within an HTML element, such as images or tables, was specified by the HTML align attribute.

5

alt

The alt attribute is essential for supplying alternative text for images, facilitating accessibility, and improving user experience.

6

async

The HTML async attribute is a Boolean attribute that is used to specify the script to execute/run as soon as it’s loaded.

7

autofocus

The HTML autofocus attribute is a boolean attribute that is used to specify that an element should be autofocused after the page has loaded.

8

bgcolor

The HTML bgcolor attribute or property is used to represent the background color of elements.

9

border

The border of an HTML element, such as tables and images, can be specified using the HTML border attribute.

10

charset

The HTML charset attribute is used for the character encoding in the HTML document.
11

checked

The HTML checked attribute is a boolean attribute that indicates whether a checkbox is checked by default (when the page loads).
12

class

One or more classes can be specified for an HTML element using the class attribute, which is a fundamental element.

13

color

The HTML color attribute is used to set the text color of the font element.
14

cols

The HTML cols attribute is used to set or specify the visible width of a text area element.
15

colspan

The HTML colspan attribute is used to define how many table columns a cell should span or extend.
16

content

The HTML content attribute is used to display/contain the value for the name or HTTP-equiv attribute, depending on which is used.
17

coords

The HTML coords attribute is used to specify/set the coordinates of an area in an image map.
18

data

The HTML data attribute is used to specify the URL for the resource.
19

datetime

The HTML datetime attribute is used to indicate the date and time associated with the element.
20

default

The HTML default attribute is a boolean attribute that is used to indicate that a track should be enabled unless the user's preferences indicate that another track is more appropriate.
21

defer

The HTML defer attribute is a boolean attribute that specifies that the script is downloaded parallel to parsing the page, and is executed after parsing the page.
22

dirname

The HTML dirname attribute is used to enable the submission of the directionality of the element.
23

disabled

The HTML disabled attribute is used to specify that the element is disabled.
24

download

The HTML download attribute is used to specify that the resource( the file or resource specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
25

enctype

The HTML enctype attribute is used to specify how the form input data should be encoded before sending it to the server.
26

formaction

The HTML formaction attribute is used to specify an URL of the file that will process the input controls and redirect to a different page when the form is submitted.
27

headers

The HTML header attribute is used to specify a table cell that contains the header information for the current data cell.
28

height

In HTML, the height attribute is frequently used to specify the vertical dimension in pixels of an element, such as an image or an iframe.

29

high

The HTML high attribute is used to specify the lower bound of an upper range.
30

href

The HTML href attribute is used to specify the URL that a hyperlink points to.
31

hreflang

The HTML hreflang attribute is used to specify the language of the linked document or URL.
32

httpequiv

The HTML http-equiv attribute is used to define the pragma directive.
33

id

An HTML element that is used to identify an HTML element on a webpage is the id attribute.

34

ismap

The HTML ismap attribute is a Boolean attribute that is used to specify that the image is part of a server-side image map.
35

kind

The HTML kind attribute is used to specify the kind of text track for the audio/video.
36

list

The HTML list attribute refers to the datalist element that contains the predefined options for an input element.
37

low

The HTML low attribute indicates the upper limit of the lower range.
38

max

The HTML max attribute is used to define the maximum value that is acceptable and valid for an input field.
39

maxlength

The HTML maxlength attribute is used to define the maximum number of characters the user can enter into an ‘input’ and ‘textarea’ field.
40

media

The HTML media attribute is used to specify a hint of the media for which the linked resource was designed.
41

method

The HTML method attribute is used to define which HTTP method to use when submitting the form.
42

minlength

The HTML minlength attribute is used to define the minimum number of characters that a user can enter into an 'input' or 'textarea' field.
43

min

For input elements such as <input type="number">, <input type="date">, or <input type="time">, the min attribute in HTML is used to define the minimal value.
44

multiple

The HTML multiple attribute is a Boolean attribute, and if present, it allows form controls to accept more than one value.
45

name

The HTML name attribute is used to specify the name of an element.
46

open

The open attribute is an HTML attribute that indicates or specifies whether the details, that is, the contents of the <details> element, are currently visible.
47

optimum

The optimum is an HTML attribute that specifies the range where the gauge’s (to determine the capacity of contents or estimate a judge's) value is considered to be an optimal value.
48

pattern

The HTML pattern attribute is usually used with input elements, particularly text fields like input and textarea.
49

placeholder

The HTML placeholder attribute is used to define a short hint that helps the user with data entry.
50

poster

The HTML poster attribute is used to specify an image/poster for the video.
51

readonly

The HTML readonly attribute is used to specify that an input, or textarea field, is read-only.
52

rel

The rel is an HTML attribute that specifies the relationship between the current document and the linked document or resource.
53

required

The HTML required attribute is a boolean attribute. It is used to specify that an input field must be filled by users before submitting the form.
54

reversed

This attribute can be helpful when you want to show a countdown or sort items by decreasing value.
55

rows

The rows is an HTML attribute that is used to specify the height of the textarea in lines.
56

rowspan

The rowspan is an HTML attribute that specifies the number of rows spanned by a cell or grid cell within a table or grid.
57

sandbox

The sandbox is an HTML attribute that stops a document loaded in an iframe from using certain features (such as submitting forms or opening new windows).
58

scope

The scope is an HTML attribute that is used to define the header cell.
59

selected

In HTML, to choose element's options from a dropdown menu are utilized using the selected attribute.
60

shape

The shape is an HTML attribute used to specify an area's shape.
61

size

The size is an HTML attribute that is used to specify the initial width of the input field and the number of visible rows for the selected element.
62

sizes

The sizes is an HTML attribute that specifies the sizes of the linked resources. It is used to provide the sizes of icons for visual media.
63

src

The HTML src attribute is used to represent external resources such as images, videos, audio, and URLs in the page from the external or device resource.
64

span

The span attribute is an HTML attribute that specifies the number of columns a <col> or <colgroup> element should span.
65

srcdoc

The srcdoc is an HTML attribute that specifies the HTML content on the page to show in the inline frame.
66

srclang

The srclang attribute is an HTML attribute that is used to specify the language of the track text.
67

srcset

The srcset is an HTML attribute that is used to specify the URL of an image to use in different situations.
68

start

The start attribute is an HMTL attribute that specifies the initial value of the ordered list in numeric form.
69

step

It is used to set the interval between legal numbers or the distinct step size of the <input> tag.
70

style

The HTML style attribute contains a CSS styling declaration and is used to apply it to an element.
71

target

The target is an HTML attribute that is used to specify where to open the linked document.
72

type

The type is an HTML attribute that specifies the type of element.
73

usemap

The usemap is an HTML attribute that creates relationships between <img> and <map> by specifying an image or an object with clickable areas.
74

value

For various form elements like input fields, checkboxes, radio buttons, and select options, the initial or default value is specified using the HTML value attribute.
75

width

The width of an element can be specified in pixels or as a percentage of its parent container using the HTML width attribute.

76

wrap

The wrap attribute of HTML ref is used to wrap the text in a text area when submitted in a HTML form.

Global Attributes

Following are the global attributes that are listed below −

Sr.No Attribute & Description
1

accesskey

The accesskey is a global attribute that provides a hint for generating a keyboard shortcut for the current element.
2

class

The class is a global attribute that is used to specify the class name for the current element or tag.
3

contenteditable

The contenteditable attribute is an HTML global attribute that specifies or indicates whether or not the content present in the browser is editable by the user.
4

data-*

Used to store custom data associated with the element.
5

dir

The dir attribute is used to control the text direction in websites.
6

draggable

The draggable is an HTML global attribute that is used to specify whether an element is draggable or not.
7

hidden

The Hidden HTML Global attribute indicates that the content of an element should not be displayed to the user.
8

id

The id is an HTML global attribute that defines an identifier (id) that must be unique in the whole HTML document.
9

lang

The lang attribute is an HTML Global attribute that is used to define the language of an element's content.
10

spellcheck

Several elements, including text input fields and contenteditable elements, can have the spellcheck global attribute applied to them in HTML.
11

style

A global attribute in HTML called style enables programmers to apply inline CSS styles to HTML elements.
12

tabindex

Specifies the tab order of an element.
13

title

A text to display in a tool tip.
14

translate

A global attribute called translate was created to facilitate the translation and internationalization of web content.
Advertisements