Know All About Global Attributes in HTML
HTML Global Attributes are those attributes that can be used anywhere in HTML tags. These attributes give meaning to HTML which defines attributes property as well. Though with some elements they have no effect at all. Few of these Attributes were added in HTML5 and marked.
List of HTML5 Global Attributes and their definition
No. | Name of the Attribute | Value | Description |
---|---|---|---|
1 | Accesskey (Accesskey) | Label key for the function | When used it specifies a shortcut for activating an element e.g. press Windows key + F6 |
2 | class | Points to specific CSS | Class attributes bind the elements with their CSS |
3 | contenteditable | ‘True’ or ‘False’ | This attributes guides whether the element is editable or not |
4 | contextmenu | ID Specific | Right-click on the context area to find the custom menu defined for that section |
5 | data | Any information or data | Using this attribute one can add information to be used in the application directly |
6 | dir | ‘ltr’ ‘rtl’ ‘auto’ | the direction of the text in case of multi-use of languages |
7 | draggable | ‘True’ or ‘False’ | This attribute specifies whether an element is draggable or not |
8 | dropzone | ‘Copy’ ‘Move’ ‘Link’ | These attributes can allow elements to copy move or link to other elements |
9 | hidden | use to hide | It instructs the browser whether that element is not yet or is no longer useful now |
10 | id | created uniquely | Specifies the function and characteristics of every unique ID made |
11 | lang | Language tag | This attribute corresponds to the language of the element |
12 | spellcheck | ‘True’ ‘False’ | Spellcheck simply instructs the browser to whether check the spelling and grammar or not |
13 | style | String | This tag is used to add inline CSS for elements that override global CSS as well as any other properties allocated to that element. |
14 | tabindex | Integer value | This tabindex attribute specifies the order of the element |
15 | title | Info on particular information | This attribute can add more meaningful and extra information to the element |
16 | translate | ‘Yes’ ‘No’ | This HTML attribute specifies whether the content of an element should be translated while browsing a different language or not |
In addition to these standard HTML5 Global attributes, there are also a few other attributes that are used
- xml:lang and xml:base from XHTML specification but are still used often for compatibility purposes.
- multiple aria-* attributes used for making the web accessible to disable friendly environment.(Accessible Rich Internet Applications i.e. ARIA)
- HTML Event Attributes i.e.
- Window Event Attributes : onafterprint, onbeforeprint, onbeforeunload, onerror, onhashchange, onload, onmessage, onoffline, ononline, onpagehide, onpageshow, onpopstate, onresize, onstorage, onunload
- Form Event Attribute: onblur, onchange, oncontextmenu, onfocus, oninput, oninvalid, onreset, onsearch, onselect, onsubmit
- Keyboard Events Attribute: onkeydown, onkeypress, onkeyup
- Mouse Events Attribute: onclick, ondblclick, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onwheel
- Drag Events Attribute: ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, onscroll
- Clipboard Events Attribute:onpaste, oncut, oncopy
- Media Events Attribute: onabort, oncanplay , oncanplaythrough, oncuechange, ondurationchange, onemptied, onended, onerror, onloadeddata, onloadedmetadata, onloadstart, onpause, onplay, onplaying, onprogress, onratechange, onseeked, onseeking, onstalled, onsuspend, ontimeupdate, onvolumechange, ontimeupdate, onwaiting
- Misc Events Attribute: ontoggle
You can study them later one by one for a better understanding!
Get Complete info on HTML Global Attributes PDF and download at study at your own will.
Also, Check Out