There are various kinds of attribute values in HTML 4. This document describes common types of values.
Attribute values of type CDATA are made up of a sequence of characters that may include entities. Line feeds are ignored while each carriage return and tab is replaced with a space. Browsers may ignore leading and trailing whitespace within the attribute value.
CDATA attribute values are typically case-sensitive, though this is not the case with all attributes that take CDATA values.
Attribute values of type ID and NAME must begin with a letter in the range A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). These values are case-sensitive.
IDREF and IDREFS values refer to values of other elements' ID attributes. An IDREF value is a single ID while an IDREFS value is a space-separated list of IDs. IDREF and IDREFS are case-sensitive.
Number attribute values are numbers made of at least one digit in the range 0-9.
Text attribute values are CDATA values intended to be human readable strings.
URI attribute values are Uniform Resource Identifiers (URIs), as defined in RFC 2396.
URI attribute values may include full URIs such as http://www.htmlhelp.com/ as well as relative URIs such as foo.html and ../foo/.
While parts of a URI may be case-insensitive, in general URI values are case-sensitive.
Color attribute values give a color definition. The value can be any hexadecimal number, specified according to the sRGB color space, or one of sixteen color names. Hexadecimal numbers must be prefixed by a "#" character.
The case-insensitive color names and their sRGB values are as follows:
|Color Name||sRGB Value|
These attribute values are integers that represent a number of pixels.
Length attribute values may be either an integer--interpreted as a number of pixels--or a percentage of the horizontal or vertical space. The value 50% means half the available space while 50 means 50 pixels.
MultiLength attribute values may be an integer in pixels, a percentage of the horizontal or vertical space, or a relative length expressed as n* where n is an integer. In allotting space, a browser first allots pixel and percentage lengths, then divides the remaining space among all elements with a relative length. An element with a length of 3* will be allotted three times the space of an element with length 1*. The value * is equivalent to 1* and is often used to mean "fill the remaining space."
A MultiLengths value is a comma-separated list of MultiLength values.
These attribute values are content types (also known as media types or MIME types) of a linked or embedded resource. Values of type ContentType give a single content type while values of type ContentTypes give a comma-separated list of content types. Content types are case-insensitive.
Attribute values of type LanguageCode specify a language code according to RFC 1766. Examples of language codes include en for English, en-US for American English, and ja for Japanese. Whitespace is not allowed in the language code, which is case-insensitive.
These attribute values specify character encodings of linked resources. Values of type Charset give a single character encoding while values of type Charsets give a space- and/or comma-separated list of character encodings. Character encodings are case-insensitive.
Examples of character encodings include ISO-8859-1, Shift_JIS, and UTF-8. A list of registered character encodings is available at the IANA.
Character attribute values take a single Unicode character. The character may be specified with an entity.
Datetime attribute values give a date and time in the format YYYY-MM-DDThh:mm:ssTZD where YYYY is a four-digit year, MM is a two-digit month (01 through 12), DD is a two-digit day (01 through 31), hh is a two-digit hour (00 through 23), mm is a two-digit minute (00 through 59), ss is a two-digit second (00 through 59), and TZD is the time zone designator. Note that the T separating the date from the time must appear literally and is case-sensitive.
The time zone designator may be one of the following:
If any of the two-digit components of the Datetime value are unknown, 00 should be used.
Attribute values of type LinkTypes give a space-separated list of link types. A link type is case-insensitive and may not contain whitespace. Each link type may be used any number of times in a given document.
While link types are case-insensitive, the Lynx browser will render LINK elements with the same case as is given in the REL or REV attribute. Authors should therefore be consistent in their case, and may wish to capitalize the first letter while using lowercase for the rest.
The following link types are defined in HTML 4, though authors may use other link types. The Made link type, widely used as <LINK REV=Made HREF="mailto:email@example.com"> to provide a contact link for the document author, is notably missing from the list of link types defined in HTML 4.
Attribute values of type MediaDesc are media descriptors--a comma-separated list of media for which the linked resource is tailored. Media descriptors are case-sensitive.
The following media descriptors are defined in HTML 4:
Script attribute values are client-side scripts, typically a function call or a few short statements. The value may contain entities (e.g., ").
Attribute values of type StyleSheet are style sheet data. The value may contain entities.
Attribute values of type FrameTarget must begin with a letter in the range A-Z or a-z, with the exception of the following special values that begin with an underscore:
In HTML 4, the TARGET attribute value is case-insensitive, so that _top and _TOP both have the same meaning. However, most browsers treat the TARGET attribute value as case-sensitive and do not recognize _TOP as having the special meaning of _top.