Attributes are additional information provided by HTML elements.
- HTML elements can set attributes
- Attributes can add additional information to an element
- Attributes are generally described in the start tag
- Attributes always appear as name/value pairs, eg: name=”value” .
HTML links are defined by <a> tags. The address of the link is specified in the href attribute :
<a href=”https://www.coding180.com” > This is a link </a>
HTML attributes commonly refer to attribute values
Property values should always be enclosed in quotes.
Double quotes are the most common, but single quotes are fine.
Tip: In some individual cases, such as the attribute value itself contains double quotes, then you must use single quotes, for example: name=’John “ShotGun” Nelson’
HTML Tip: Use lowercase attributes
Properties and property values are not case-sensitive.
However, the World Wide Web Consortium recommends lowercase attributes/attribute values in its HTML 4 Recommendation.
Newer versions of (X)HTML require lowercase attributes.
HTML Attributes Reference Manual
See the complete list of HTML attributes: HTML Tag Reference Manual .
The attributes that apply to most HTML elements are listed below:
|class||Define one or more classnames (classnames) for html elements (classnames are imported from style files)|
|id||Defines the unique id of the element|
|style||Specifies the inline style of the element|
|title||Additional information describing the element (used as a toolbar)|
More standard attribute descriptions: HTML Standard Attributes Reference Manual .