Complete Technology Solutions, Web Design, Management, Maintenance   
   
 

 Complete Technology Solutions
  - HTML 4.0 Attribute Values


      FAQ - Contact Us

HTML 4.0 Attribute Values

There are various kinds of attribute values in HTML 4.0. This document describes common types of values.

-- CDATA --

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.

Back to the Top

-- ID and NAME --

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.

Back to the Top

-- IDREF and IDREFS --

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.

Back to the Top

-- Number --

Number attribute values are numbers made of at least one digit in the range 0-9.

Back to the Top

-- Text --

Text attribute values are CDATA values intended to be human readable strings.

Back to the Top

-- URI --

URI attribute values are Uniform Resource Identifiers (URIs), as defined in RFC 2396.

URI attribute values may include full URIs such as http://www.infinitesurf.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.

Back to the Top

-- Color --

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
Black #000000
Silver #C0C0C0
Gray #808080
White #FFFFFF
Maroon #800000
Red #FF0000
Purple #800080
Fuchsia #FF00FF
Green #008000
Lime #00FF00
Olive #808000
Yellow #FFFF00
Navy #000080
Blue #0000FF
Teal #008080
Aqua #00FFFF

Note that the hexadecimal form is better supported than the color names for the color attributes of BODY.

Back to the Top

-- CDATA --

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.

Back to the Top

-- Pixels --

These attribute values are integers that represent a number of pixels.

Back to the Top

-- Length --

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.

Back to the Top

MultiLength attribute values may be an integer in pixels, a percentage of the horizontal or vertical space, or a relative length expressed as i* where i 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.

Back to the Top

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.

Commonly used content types include text/html, image/jpeg, model/vrml, video/quicktime, application/java, text/css, and text/javascript. Many common content types are registered at the IANA.

Back to the Top

-- LanguageCode --

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.

Back to the Top

-- Charset and Charsets --

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.

Back to the Top

-- Character --

Character attribute values take a single Unicode character. The character may be specified with an entity.

Back to the Top

-- Datetime --

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:

  • Z (case-sensitive), which indicates Coordinated Universal Time (UTC, basically the same as GMT);
  • +hh:mm, the time ahead of UTC in hours and minutes;
  • -hh:mm, the time behind UTC in hours and minutes.

If any of the two-digit components of the Datetime value are unknown, 00 should be used.

Back to the Top

-- LinkTypes --

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.0, though authors may use other link types. The Made link type, widely used as <LINK REV=Made HREF="mailto:fred@infinitesurf.com"> to provide a contact link for the document author, is notably missing from the list of link types defined in HTML 4.0.

  • Alternate specifies an alternate version of the document. When used with the LINK element's HREFLANG attribute, this value implies a translation of the document. When used with LINK's MEDIA attribute, a media-specific version (e.g., for printing) is implied.
  • StyleSheet specifies an external style sheet for the document. This link type can be combined with the Alternate link type to define an alternate style sheet for the user to choose.
  • Start specifies the first document in a collection.
  • Next specifies the next document in a suggested sequence of reading. Browsers such as WebTV will preload documents identified as "next" to improve the perceived load time.
  • Prev specifies the previous document in a suggested sequence of reading.
  • Contents specifies a table of contents for the document.
  • Index gives an index for the document.
  • Glossary gives a glossary of terms used in the document.
  • Copyright specifies a document with copyright information.
  • Chapter specifies the chapter of a collection of documents.
  • Section specifies the section of a collection of documents.
  • Subsection specifies a subsection of a collection of documents.
  • Appendix gives an appendix for the collection of documents.
  • Help specifies a help document.
  • Bookmark refers to a key related document. The TITLE attribute provides a label for the bookmark.

Back to the Top

-- MediaDesc --

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

  • screen (the default), for non-paged computer screens;
  • tty, for fixed-pitch character grid displays (such as the display used by Lynx);
  • tv, for television-type devices with low resolution and limited scrollability;
  • projection, for projectors;
  • handheld, for handheld devices (characterized by a small, monochrome display and limited bandwidth);
  • print, for output to a printer;
  • braille, for braille tactile feedback devices;
  • aural, for speech synthesizers;
  • all, for all devices.

Back to the Top

-- Script --

Script attribute values are client-side scripts, typically a function call or a few short statements. The value may contain entities (e.g., &quot;).

Back to the Top

-- StyleSheet --

Attribute values of type StyleSheet are style sheet data. The value may contain entities.

Back to the Top

-- FrameTarget --

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:

  • _blank renders the link in a new, unnamed window
  • _self renders the link in the current frame (useful for overriding a BASE TARGET)
  • _parent renders the link in the immediate FRAMESET parent
  • _top renders the link in the full, unframed window

In HTML 4.0, 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.

Back to the Top


Click Here for InfiniteSurf.com Homepage