HTML/Attribute Values
From The Ultimate Programming Reference
m (Typos) |
|||
Line 111: | Line 111: | ||
While link types are case-insensitive, the [http://lynx.browser.org/ Lynx] browser will render [[HTML\\Tags\\LINK|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. | While link types are case-insensitive, the [http://lynx.browser.org/ Lynx] browser will render [[HTML\\Tags\\LINK|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:nobody@editthis.info"> to provide a contact link for the document author, is notably missing from the list of link types defined in HTML 4.0. | + | The following link types are defined in HTML 4.0, though authors may use other link types. The '''Made''' link type, widely used as <pre><LINK REV=Made HREF="mailto:nobody@editthis.info"></pre> 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 [[HTML\\Tags\\LINK|LINK]] element's '''HREFLANG''' attribute, this value implies a translation of the document. When used with [[HTML\\Tags\\LINK|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 [[HTML/Common Attributes#TITLE|TITLE]] attribute provides a label for the bookmark. | |
==MediaDesc== | ==MediaDesc== | ||
Line 135: | Line 135: | ||
The following media descriptors are defined in HTML 4.0: | 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. | |
==Script== | ==Script== | ||
- | Script attribute values are client-side scripts, typically a function call or a few short statements. The value may contain entities (e.g., "). | + | Script attribute values are client-side scripts, typically a function call or a few short statements. The value may contain [[HTML\\Entities|entities]] (e.g., "). |
StyleSheet | StyleSheet | ||
- | Attribute values of type StyleSheet are style sheet data. The value may contain entities. | + | Attribute values of type StyleSheet are style sheet data. The value may contain [[HTML\\Entities|entities]]. |
- | FrameTarget | + | ==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: | 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 | * _blank renders the link in a new, unnamed window | ||
- | * _self renders the link in the current frame (useful for overriding a BASE TARGET) | + | * _self renders the link in the current frame (useful for overriding a [[HTML\\Tags\\BASE|BASE]] '''TARGET''') |
- | * _parent renders the link in the immediate FRAMESET parent | + | * _parent renders the link in the immediate [[HTML\\Tags\\FRAMESET|FRAMESET]] parent |
* _top renders the link in the full, unframed window | * _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. | 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. |
Current revision as of 07:50, 2 May 2006
Contents |
[edit] 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.
[edit] ID
[edit] 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.
[edit] IDREF
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.
[edit] Number
Number attribute values are numbers made of at least one digit in the range 0-9.
[edit] Text
Text attribute values are CDATA values intended to be human readable strings.
[edit] 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.editthis.info/ 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.
[edit] 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.
[edit] Pixels
These attribute values are integers that represent a number of pixels.
[edit] 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. MultiLength and MultiLengths
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.
[edit] ContentType
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.
[edit] 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.
[edit] Charset
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.
[edit] Character
Character attribute values take a single Unicode character. The character may be specified with an entity.
[edit] 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.
[edit] 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:nobody@editthis.info">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.
[edit] 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.
[edit] Script
Script attribute values are client-side scripts, typically a function call or a few short statements. The value may contain entities (e.g., "). StyleSheet
Attribute values of type StyleSheet are style sheet data. The value may contain entities.
[edit] 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.