HTML Fundamentals Tutorial
About Lesson

HTML attributes are extra bits of information you can add to HTML tags to provide additional context or functionality. They are typically added as key-value pairs within the opening tag of an element.

Global attributes are those that can be used with any HTML element. They apply universally across most HTML tags.

Some common global attributes include:

    • id: Specifies a unique identifier for an element within a document.
    • class: Assigns one or more class names to an element, which can be used for styling or scripting purposes.
    • style: Allows you to specify CSS styles directly for an element.
    • title: Provides a title or additional information about an element, typically displayed as a tooltip when the user hovers over the element.
    • data-*: Allows custom data attributes to be added to elements, typically used for scripting purposes.
    • lang: Specifies the language of the content within an element.
    • dir: Defines the direction of text, either left-to-right or right-to-left.

Global attributes are versatile and can be applied to various HTML elements.

Join the conversation