HTML Attributes

Attributes are additional information provided by HTML elements.

HTML Attributes

  • HTML elements can set attributes

  • Attributes can add additional information to the element

  • The attributes are generally described in the openning tag

  • Attributes always appear in the form of name/value pairs, for example: name="value" .

Property Instance

The HTML link is defined by the <a> tag. The address of the link is specified in the href attribute :


<a href="">This is a link</a>

Try It!

HTML Attributes Commonly Reference Attribute Values

The attribute value should always be enclosed in quotation marks.

Double quotation marks are the most commonly used, but there is no problem with using single quotation marks.

RemarkTip: In some individual cases, for example, the attribute value itself contains double quotes, then you must use single quotes, for example: name='John "ShotGun" Nelson'

HTML Tip: Use Lowercase Attributes

Attributes and attribute values are not case sensitive.

However, the World Wide Web Consortium recommends lowercase attributes/attribute values in its HTML 4 recommendations.

The new version of (X)HTML requires lowercase attributes.

HTML Attribute Reference Manual

See the complete list of HTML attributes: HTML Tag Reference Manual .(under construction)

The attributes that apply to most HTML elements are listed below:

classDefine one or more class names for html elements (class names are imported from style files)
idDefine the unique id of the element
styleSpecifies the inline style of the element (inline style)
titleDescribes the extra information of the element (used as a toolbar)

More standard attribute description: HTML standard attribute reference manual .(under construction)