HTML Basic
HTML Entity
- HTML Entity
- HTML Alphabet Entity
- HTML Arrow Entity
- HTML Currency Entity
- HTML Math Entity
- HTML Number Entity
- HTML Punctuation Entity
- HTML Symbol Entity
HTML IndexedDB
HTML Reference
HTML Global Attributes
Photo Credit to CodeToFun
What is HTML Global Attributes?
HTML Global Attributes are attributes that can be used on any HTML element.
These attributes provide common functionality and behaviors that can be applied universally across different HTML elements.
Here are some commonly used HTML Global Attributes:
Attribute | Value | Explanation |
---|---|---|
accesskey | character | Defines a keyboard shortcut to activate or focus the element. |
aria-* | name | Attributes used for accessibility purposes, providing additional information to assistive technologies. |
class | name | Specifies one or more CSS classes to apply to the element, allowing for CSS styling and selection. |
contenteditable | bool | Specifies whether the element's content can be edited by the user. |
data-* | name | Allows custom data attributes to be added to elements for storing additional data. |
dir |
| Specifies the text direction for the content in an element. |
draggable | bool | Indicates whether the element is draggable or not. |
hidden | - | Hides the element from view by default. |
id | name | Provides a unique identifier for the element, which can be used for JavaScript manipulation or CSS styling. |
lang | language_code | Specifies the language of the content within the element. |
spellcheck | bool | Specifies whether the content of the element have to check spelling. |
style | CSS Properties | Defines inline CSS styles for the element, allowing for custom styling. |
tabindex | number | Specifies the order in which elements are focused when using the tab key for keyboard navigation. |
title | text | Provides a title or tooltip text that is displayed when the user hovers over the element. |
Deprecated HTML Global Attributes
Deprecated HTML Global Attributes are attributes that were once part of the HTML specification but are no longer recommended for use.
While some deprecated attributes may still work in modern browsers, it is considered best practice to avoid using them and instead use more modern alternatives.
Here are some commonly used deprecated HTML Global Attributes:
Attribute | Explanation |
---|---|
autocapitalize | Specifies whether and how text input is automatically capitalized. |
contextmenu | Specifies the id of a <menu> to use as the contextual menu for this element. |
dropzone | Specifies whether dragged and dropped data should be copy, move or link. |
translate | Specifies whether to translate an element when the page is localized. |
align | Used to align elements horizontally, vertically, or both. Deprecated in favor of CSS for styling and layout. |
bgcolor | Sets the background color of an element. Deprecated in favor of CSS for styling. |
border | Specifies the border width of an element. Deprecated in favor of CSS for styling. |
cellpadding | Sets the padding between the content of a cell and its border in a table. Deprecated in favor of CSS for styling. |
cellspacing | Sets the spacing between cells in a table. Deprecated in favor of CSS for styling. |
frame | Specifies which sides of a frame to display. Deprecated in favor of CSS for layout and styling. |
hspace | Sets the horizontal spacing around an element. Deprecated in favor of CSS for styling. |
vspace | Sets the vertical spacing around an element. Deprecated in favor of CSS for styling. |
width | Sets the width of an element. Deprecated in favor of CSS for layout and styling. |
alink | Deprecated attributes related to link and visited link colors. Replaced by CSS for styling. |
👨💻 Join our Community:
Author
For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.
Buy me a coffee to make codetofun.com free for everyone.
Buy me a Coffee
If you have any doubts regarding this article (HTML Global Attributes) please comment here. I will help you immediately.