attributes

What are HTML Attributes?

HTML attributes provide additional information about HTML elements. Attributes are always included in the opening tag and are written as name/value pairs like this:

<element attribute="value">

For example, the <a> (anchor) element can use the href attribute to specify the URL of the link:

<a href="https://www.example.com">Visit Example</a>

Common HTML Attributes

Here are some of the most commonly used HTML attributes:

Element-Specific Attributes

Some HTML attributes are only used with specific elements. Here are a few examples:

Global Attributes

Global attributes can be used on any HTML element. Here are some commonly used global attributes: