English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Basic Tutorial

HTML Media

HTML Reference Manual

HTML5 Basic Tutorial

HTML5 API

HTML5 Media

HTML Attributes

Attributes are additional information provided by HTML elements, such as width, height, style, etc.

HTML Attributes

  • HTML elements can set attributes

  • Attributes can add additional information to the element

  • Attributes are generally described in the start tag

  • Attributes are always named/appear in the form of value pairs, such as: target="_blank".

Attribute example

HTML hyperlinks are defined by the <a> tag, and the address of the hyperlink is specified in the href attribute:

<a href="https://www.oldtoolbag.com">This is a hyperlink</a>
Test to see ‹/›

Commonly used HTML attribute values

Attribute values should always be enclosed in quotes.

Double quotes are the most commonly used, but it is also fine to use single quotes.

Tip: In some individual cases, such as attribute values themselves containing double quotes, then you must use single quotes, for example: name='John "ShotGun" Nelson&39;

HTML Tip: Use lowercase attributes

Attributes and attribute values are case-insensitive.

However, the World Wide Web Consortium in its HTML 4 Recommended in the standard recommendations for lowercase attributes/Attribute values.

While the new version of (X)HTML requires the use of lowercase attributes.

Suggestion: Use lowercase tags consistently

HTML Attribute Reference Manual

View the complete list of HTML attributes:HTML Tag Reference Manual.

The following lists the attributes applicable to most HTML elements:

AttributeDescription
classDefine one or more class names (class names from style sheets)
idDefine the unique id of the element
styleDefine the inline style of the element
titleAdditional information about the element (used as a toolbar)

More standard attribute descriptions:HTML Standard Attribute Reference Manual.