Standard attribute
Updated: 09/12/2023 by Computer Hope
With HTML (hypertext markup language), a standard attribute, also known as a global attribute, is any attribute supported by all HTML elements. For example, the "class" attribute can be used in any HTML tag, but an attribute like "src" can only be used in HTML tags like img and frame.
Global attribute list
The following table contains a list of the standard attributes and a description of their appropriate usage.
Attribute | Description |
---|---|
accesskey | Designates a keyboard shortcut to focus on an element. |
class | Designates one or more CSS (cascading style sheets) classes to be applied to the element. |
contenteditable | Designates whether or not the content of an element may be edited. |
contextmenu | Adds a context menu when an element is right-clicked. |
data-* | Stores private data about an application or web page. |
dir | Designates the direction of text within an element. |
draggable | Designates whether or not the content of an element may be dragged. |
dropzone | Designates where dropped data goes (copied, moved, or linked). |
hidden | Designates that an element is no longer used or hasn't yet become relevant. |
id | Gives an element a unique identification for a named anchor. |
lang | Designates the language of the text used in an element. |
spellcheck | States whether or not an element needs its spelling checked for error. |
style | Designates an inline CSS style for an element. |
tabindex | Changes how tabbing works within an element. |
title | Adds extra information about an element that is shown on hover. |
translate | Designates whether or not the language used within an element needs to be translated. |