HTML Global Attributes are attributes that can be used with any HTML element. These attributes provide common functionality and can be used to apply styles, specify behaviors, and provide additional information to the web page.
Here are some of the commonly used HTML Global Attributes:
class: Specifies one or more classes for an HTML element, which can be used to apply styles to a group of elements.
id: Specifies a unique identifier for an HTML element, which can be used to refer to the element from CSS or JavaScript .
style: Specifies inline styles for an HTML element, which can be used to apply specific styles to a single element.
title: Specifies additional information about an HTML element, which is displayed as a tooltip when the user hovers over the element.
data-*: Specifies custom data attributes for an HTML element, which can be used to store extra information about the element that can be accessed by JavaScript .
lang: Specifies the language of the content in an HTML element, which can be used by screen readers and search engines to understand the content.
tabindex: Specifies the tab order of an HTML element when the user navigates using the keyboard.
accesskey: Specifies a keyboard shortcut to activate an HTML element.
contenteditable: Specifies whether an HTML element can be edited by the user.
hidden: Specifies whether an HTML element should be hidden from the user.
aria-*: Specifies accessibility-related attributes for an HTML element, which can be used to provide additional information for screen readers and other assistive technologies.
draggable: Specifies whether an HTML element can be dragged by the user.
dropzone: Specifies which types of data can be dropped onto an HTML element.
role: Specifies the role of an HTML element in the web page, which can be used to provide additional information for assistive technologies.
spellcheck: Specifies whether the spelling and grammar of an HTML element should be checked.
translate: Specifies whether the content of an HTML element should be translated.
dir: Specifies the direction of the text in an HTML element, which can be used for languages that are read from right to left.
onload: Specifies a JavaScript function to be executed when an HTML element has finished loading.
onclick: Specifies a JavaScript function to be executed when an HTML element is clicked.
onmouseover and onmouseout: Specifies JavaScript functions to be executed when the user moves the mouse over or away from an HTML element, respectively.
HTML Global Attributes provide a wide range of functionality and flexibility for web developers. By using these attributes appropriately, developers can create more dynamic and interactive web pages that provide a better user experience.