In this tutorial, you will learn Global Attributes which are common for all HTML elements. The global attributes assist by both standard and non-standard elements.
The global attributes can be used with all elements, even they may not have any effect on many elements.
HTML defines many attributes that are common to all elements. These attributes may be specified on all elements, with some exceptions where it is not suitable. Like <head> section of the document E.g , <script>, <base> etc.
HTML Global Attributes
Here, I will show you a full list of global attributes with the description:
Attributes | Value | Description |
---|---|---|
accesskey | character | It is used to create keyboard shortcuts for the element. |
class | classname | It is used to give the class name for the element. It is mostly use with the CSS stylesheet. |
Contenteditable | true false |
It confirm whether the content within an element is editable. |
data-* | somevalue | It is used to save element-specific private data that can be retrieve by Javascript. |
contextmenu | menu_id | It describe the id for the <menu> element that is used as a context menu for an element. |
draggable | true false auto |
It defines either the content within an element is portable or not using Drag and Drop API. |
dir | rtl ltr auto |
It defines the controle of the content inside the current element. |
dropzone | copy move link |
It defines the action is taken on the dragged element when it is dropped, ¬¬ such as whether it is copied, moved or linked. |
id | id | It defines a unique id for the element. It can be use with CSS and JavaScript. |
hidden | It is used to hide the element from view of the document. | |
style | style | It is used to apply inline CSS to the element. |
lang | language-code | It defines the primary language for the content of an element. |
spellcheck | true false | It defines either the content should be checked for spelling errors or not. |
translate | yes no |
It defines whether the content of the element should be translated when the web page is localized or not. |
title | text | It is used to give the title, or some extra information about the element. |