Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

HTML Global Attributes

Posted in HTML Tutorial
Updated on Sep 22, 2024
By Mari Selvan
👁️ 164 - Views
⏳ 4 mins
💬 1 Comment
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:

AttributeValueExplanation
accesskeycharacterDefines a keyboard shortcut to activate or focus the element.
aria-*nameAttributes used for accessibility purposes, providing additional information to assistive technologies.
classnameSpecifies one or more CSS classes to apply to the element, allowing for CSS styling and selection.
contenteditableboolSpecifies whether the element's content can be edited by the user.
data-*nameAllows custom data attributes to be added to elements for storing additional data.
dir
  • ltr
  • rtl
  • auto
Specifies the text direction for the content in an element.
draggableboolIndicates whether the element is draggable or not.
hidden-Hides the element from view by default.
idnameProvides a unique identifier for the element, which can be used for JavaScript manipulation or CSS styling.
langlanguage_codeSpecifies the language of the content within the element.
spellcheckboolSpecifies whether the content of the element have to check spelling.
styleCSS PropertiesDefines inline CSS styles for the element, allowing for custom styling.
tabindexnumberSpecifies the order in which elements are focused when using the tab key for keyboard navigation.
titletextProvides 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:

AttributeExplanation
autocapitalizeSpecifies whether and how text input is automatically capitalized.
contextmenuSpecifies the id of a <menu> to use as the contextual menu for this element.
dropzoneSpecifies whether dragged and dropped data should be copy, move or link.
translateSpecifies whether to translate an element when the page is localized.
alignUsed to align elements horizontally, vertically, or both. Deprecated in favor of CSS for styling and layout.
bgcolorSets the background color of an element. Deprecated in favor of CSS for styling.
borderSpecifies the border width of an element. Deprecated in favor of CSS for styling.
cellpaddingSets the padding between the content of a cell and its border in a table. Deprecated in favor of CSS for styling.
cellspacingSets the spacing between cells in a table. Deprecated in favor of CSS for styling.
frameSpecifies which sides of a frame to display. Deprecated in favor of CSS for layout and styling.
hspaceSets the horizontal spacing around an element. Deprecated in favor of CSS for styling.
vspaceSets the vertical spacing around an element. Deprecated in favor of CSS for styling.
widthSets the width of an element. Deprecated in favor of CSS for layout and styling.
alinkDeprecated attributes related to link and visited link colors. Replaced by CSS for styling.

👨‍💻 Join our Community:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

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

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mari Selvan
Mari Selvan
1 year ago

If you have any doubts regarding this article (HTML Global Attributes) please comment here. I will help you immediately.

We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy