HTML Attributes


Attributes provide additional information about HTML elements. For example, HTML links are defined with the <a> tag. The link address is provided as an attribute:
 <a href="http://www.google.com/search?q=weather">Weather</a>
Always Quote Attribute Values
Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed. In some rare situations, like when the attribute value itself contains quotes, it is necessary to use single quotes:
   name='John "ShotGun" Nelson'
HTML Tip: Use Lowercase Attributes
Attribute names and attribute values are case-insensitive. However, the World Wide Web Consortium (W3C) recommends lowercase attributes/attribute values in their HTML 4 Recommendation. Newer versions of (X)HTML will demand lowercase attributes.

HTML Attributes Reference
Below is a list of attributes that are standard for most HTML elements:

Attribute Value Description
class class_rule or style_rule The class of the element
id id_name A unique id for the element
style style_definition An inline style definition
title tooltip_text A text to display in a tool tip

Demonstration
The following demonstration shows how the HTML script is displayed on the Web.

     


Review: HTML Links
Which is NOT a valid attribute of HTML anchor tag a?
      href
      src
      target
      title
Result: