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 | acceptThe 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-charsetThe HTML accept-charset attribute is used to specify the character encodings that are to be used for the form submission. |
3 | actionThe HTML action attribute is used to specify a URL that processes the form submission. |
4 | alignThe alignment of content within an HTML element, such as images or tables, was specified by the HTML align attribute. |
5 | altThe alt attribute is essential for supplying alternative text for images, facilitating accessibility, and improving user experience. |
6 | asyncThe HTML async attribute is a Boolean attribute that is used to specify the script to execute/run as soon as it’s loaded. |
7 | autofocusThe HTML autofocus attribute is a boolean attribute that is used to specify that an element should be autofocused after the page has loaded. |
8 | bgcolorThe HTML bgcolor attribute or property is used to represent the background color of elements. |
9 | borderThe border of an HTML element, such as tables and images, can be specified using the HTML border attribute. |
10 | charsetThe HTML charset attribute is used for the character encoding in the HTML document. |
11 | checkedThe HTML checked attribute is a boolean attribute that indicates whether a checkbox is checked by default (when the page loads). |
12 | classOne or more classes can be specified for an HTML element using the class attribute, which is a fundamental element. |
13 | colorThe HTML color attribute is used to set the text color of the font element. |
14 | colsThe HTML cols attribute is used to set or specify the visible width of a text area element. |
15 | colspanThe HTML colspan attribute is used to define how many table columns a cell should span or extend. |
16 | contentThe HTML content attribute is used to display/contain the value for the name or HTTP-equiv attribute, depending on which is used. |
17 | coordsThe HTML coords attribute is used to specify/set the coordinates of an area in an image map. |
18 | dataThe HTML data attribute is used to specify the URL for the resource. |
19 | datetimeThe HTML datetime attribute is used to indicate the date and time associated with the element. |
20 | defaultThe 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 | deferThe 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 | dirnameThe HTML dirname attribute is used to enable the submission of the directionality of the element. |
23 | disabledThe HTML disabled attribute is used to specify that the element is disabled. |
24 | downloadThe 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 | enctypeThe HTML enctype attribute is used to specify how the form input data should be encoded before sending it to the server. |
26 | formactionThe 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 | headersThe HTML header attribute is used to specify a table cell that contains the header information for the current data cell. |
28 | heightIn 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 | highThe HTML high attribute is used to specify the lower bound of an upper range. |
30 | hrefThe HTML href attribute is used to specify the URL that a hyperlink points to. |
31 | hreflangThe HTML hreflang attribute is used to specify the language of the linked document or URL. |
32 | httpequivThe HTML http-equiv attribute is used to define the pragma directive. |
33 | idAn HTML element that is used to identify an HTML element on a webpage is the id attribute. |
34 | ismapThe HTML ismap attribute is a Boolean attribute that is used to specify that the image is part of a server-side image map. |
35 | kindThe HTML kind attribute is used to specify the kind of text track for the audio/video. |
36 | listThe HTML list attribute refers to the datalist element that contains the predefined options for an input element. |
37 | lowThe HTML low attribute indicates the upper limit of the lower range. |
38 | maxThe HTML max attribute is used to define the maximum value that is acceptable and valid for an input field. |
39 | maxlengthThe HTML maxlength attribute is used to define the maximum number of characters the user can enter into an ‘input’ and ‘textarea’ field. |
40 | mediaThe HTML media attribute is used to specify a hint of the media for which the linked resource was designed. |
41 | methodThe HTML method attribute is used to define which HTTP method to use when submitting the form. |
42 | minlengthThe HTML minlength attribute is used to define the minimum number of characters that a user can enter into an ‘input’ or ‘textarea’ field. |
43 | minFor 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 | multipleThe HTML multiple attribute is a Boolean attribute, and if present, it allows form controls to accept more than one value. |
45 | nameThe HTML name attribute is used to specify the name of an element. |
46 | openThe 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 | optimumThe 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 | patternThe HTML pattern attribute is usually used with input elements, particularly text fields like input and textarea. |
49 | placeholderThe HTML placeholder attribute is used to define a short hint that helps the user with data entry. |
50 | posterThe HTML poster attribute is used to specify an image/poster for the video. |
51 | readonlyThe HTML readonly attribute is used to specify that an input, or textarea field, is read-only. |
52 | relThe rel is an HTML attribute that specifies the relationship between the current document and the linked document or resource. |
53 | requiredThe 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 | reversedThis attribute can be helpful when you want to show a countdown or sort items by decreasing value. |
55 | rowsThe rows is an HTML attribute that is used to specify the height of the textarea in lines. |
56 | rowspanThe rowspan is an HTML attribute that specifies the number of rows spanned by a cell or grid cell within a table or grid. |
57 | sandboxThe 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 | scopeThe scope is an HTML attribute that is used to define the header cell. |
59 | selectedIn HTML, to choose element’s options from a dropdown menu are utilized using the selected attribute. |
60 | shapeThe shape is an HTML attribute used to specify an area’s shape. |
61 | sizeThe 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 | sizesThe 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 | srcThe 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 | spanThe span attribute is an HTML attribute that specifies the number of columns a <col> or <colgroup> element should span. |
65 | srcdocThe srcdoc is an HTML attribute that specifies the HTML content on the page to show in the inline frame. |
66 | srclangThe srclang attribute is an HTML attribute that is used to specify the language of the track text. |
67 | srcsetThe srcset is an HTML attribute that is used to specify the URL of an image to use in different situations. |
68 | startThe start attribute is an HMTL attribute that specifies the initial value of the ordered list in numeric form. |
69 | stepIt is used to set the interval between legal numbers or the distinct step size of the <input> tag. |
70 | styleThe HTML style attribute contains a CSS styling declaration and is used to apply it to an element. |
71 | targetThe target is an HTML attribute that is used to specify where to open the linked document. |
72 | typeThe type is an HTML attribute that specifies the type of element. |
73 | usemapThe usemap is an HTML attribute that creates relationships between <img> and <map> by specifying an image or an object with clickable areas. |
74 | valueFor 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 | widthThe width of an element can be specified in pixels or as a percentage of its parent container using the HTML width attribute. |
76 | wrapThe 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 | accesskeyThe accesskey is a global attribute that provides a hint for generating a keyboard shortcut for the current element. |
2 | classThe class is a global attribute that is used to specify the class name for the current element or tag. |
3 | contenteditableThe 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 | dirThe dir attribute is used to control the text direction in websites. |
6 | draggableThe draggable is an HTML global attribute that is used to specify whether an element is draggable or not. |
7 | hiddenThe Hidden HTML Global attribute indicates that the content of an element should not be displayed to the user. |
8 | idThe id is an HTML global attribute that defines an identifier (id) that must be unique in the whole HTML document. |
9 | langThe lang attribute is an HTML Global attribute that is used to define the language of an element’s content. |
10 | spellcheckSeveral elements, including text input fields and contenteditable elements, can have the spellcheck global attribute applied to them in HTML. |
11 | styleA global attribute in HTML called style enables programmers to apply inline CSS styles to HTML elements. |
12 | tabindexSpecifies the tab order of an element. |
13 | titleA text to display in a tool tip. |
14 | translateA global attribute called translate was created to facilitate the translation and internationalization of web content. |
Leave a Reply