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 opening tag
  • Attributes always appear in the form of name/value pairs, such as name=”value” .

Property instance

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


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

HTML attributes commonly reference attribute values

The attribute value should always be enclosed in quotation marks.

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

Tip: 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 .

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

Attributes description
class Define one or more class names for html elements (class names are imported from style files)
id Define the unique id of the element
style Specifies the inline style of the element (inline style)
title Describe the extra information of the element (used as a toolbar)

More standard attribute description: HTML standard attribute reference manual .