Cari di HTML4 
    HTML4 User Manual
Daftar Isi
(Sebelumnya) 5. HTML Document Representation7. The global structure of an ... (Berikutnya)

6. Basic HTML data types

This section of the specification describes the basic data types that mayappear as an element's content or an attribute's value.

For introductory information about reading the HTML DTD, please consult theSGML tutorial.

6.1 Case information

Each attribute definition includes information about the case-sensitivity of its values. The case information is presentedwith the following keys:

CS
The value is case-sensitive (i.e., user agents interpret "a" and "A"differently).
CI
The value is case-insensitive (i.e., user agents interpret "a" and "A" asthe same).
CN
The value is not subject to case changes, e.g., because it is a number or acharacter from the document character set.
CA
The element or attribute definition itself gives case information.
CT
Consult the type definition for details about case-sensitivity.

If an attribute value is a list, the keys apply to every value in the list,unless otherwise indicated.

6.2 SGML basic types

The document type definition specifies thesyntax of HTML element content and attribute values using SGML tokens (e.g.,PCDATA, CDATA, NAME, ID, etc.). See [ISO8879] for their fulldefinitions. The following is a summary of key information:

  • CDATA is a sequence of characters fromthe document character set and may include character entities. User agentsshould interpret attribute values as follows:
    • Replace character entities with characters,
    • Ignore line feeds,
    • Replace each carriage return or tab with a single space.

    User agents may ignore leading and trailing white space in CDATA attributevalues (e.g., "   myval   " may be interpreted as"myval"). Authors should not declare attribute values with leading or trailingwhite space.

    For some HTML 4 attributes with CDATA attribute values, the specificationimposes further constraints on the set of legal values for the attribute thatmay not be expressed by the DTD.

    Although the STYLE and SCRIPT elements use CDATA fortheir data model, for these elements, CDATA must be handled differently by user agents.Markup and entities must be treated as raw text and passed to the applicationas is. The first occurrence of the character sequence "</" (end-tag opendelimiter) is treated as terminating the end of the element's content. In validdocuments, this would be the end tag for the element.

  • ID and NAME tokens mustbegin with a letter ([A-Za-z]) and may be followed by any number of letters,digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods(".").
  • IDREF and IDREFS are references to ID tokens defined by otherattributes. IDREF is a single token and IDREFS is a space-separated list oftokens.
  • NUMBER tokens must contain at leastone digit ([0-9]).

6.3 Text strings

A number of attributes ( %Text; in the DTD) take text that is meant tobe "human readable". For introductory information about attributes, pleaseconsult the tutorial discussion ofattributes.

6.4 URIs

This specification uses the term URI as defined in [URI] (see also [RFC1630]).

Note that URIs include URLs (as defined in [RFC1738] and [RFC1808]).

Relative URIs are resolved to full URIs using a base URI. [RFC1808], section 3, defines the normative algorithm for this process. Formore information about base URIs, please consult the section on base URIs in the chapter on links.

URIs are represented in the DTD by the parameter entity %URI;.

URIs in general are case-sensitive.There may be URIs, or parts of URIs, where case doesn't matter (e.g., machinenames), but identifying these may not be easy. Users should always considerthat URIs are case-sensitive (to be on the safe side).

Please consult the appendix for information about non-ASCII characters in URI attributevalues.

6.5 Colors

The attribute value type "color" (%Color;) refers to color definitions asspecified in [SRGB]. A color value may either be a hexadecimal number(prefixed by a hash mark) or one of the following sixteen color names. Thecolor names are case-insensitive.

Color names and sRGB values
Black = "#000000"Green = "#008000"
Silver = "#C0C0C0"Lime = "#00FF00"
Gray = "#808080"Olive = "#808000"
White = "#FFFFFF"Yellow = "#FFFF00"
Maroon = "#800000"Navy = "#000080"
Red = "#FF0000"Blue = "#0000FF"
Purple = "#800080"Teal = "#008080"
Fuchsia = "#FF00FF"Aqua = "#00FFFF"

Thus, the color values "#800080" and "Purple" both refer to the colorpurple.

6.5.1 Notes on using colors

Although colors can add significant amounts of information to documents andmake them more readable, please consider the following guidelines whenincluding color in your documents:

  • The use of HTML elements and attributes for specifying color is deprecated. You are encouraged to use style sheets instead.
  • Don't use color combinations that cause problems for people with colorblindness in its various forms.
  • If you use a background image or set the background color, then be sure toset the various text colors as well.
  • Colors specified with the BODY and FONT elements and bgcolor on tables look differenton different platforms (e.g., workstations, Macs, Windows, and LCD panels vs.CRTs), so you shouldn't rely entirely on a specific effect. In the future,support for the [SRGB] color model together with ICC color profiles shouldmitigate this problem.
  • When practical, adopt common conventions to minimize user confusion.

6.6 Lengths

HTML specifies three types of length values for attributes:

  1. Pixels: The value (%Pixels; inthe DTD) is an integer that represents the number of pixels of the canvas(screen, paper). Thus, the value "50" means fifty pixels. For normativeinformation about the definition of a pixel, please consult [CSS1].
  2. Length: The value (%Length; inthe DTD) may be either a %Pixel; or a percentage of the available horizontal orvertical space. Thus, the value "50%" means half of the available space.
  3. MultiLength: The value (%MultiLength; in the DTD) may be a %Length; or a relative length. A relative length has the form "i*", where"i" is an integer. When allotting space among elements competing for thatspace, user agents allot pixel and percentage lengths first, then divide upremaining available space among relative lengths. Each relative length receivesa portion of the available space that is proportional to the integer precedingthe "*". The value "*" is equivalent to "1*". Thus, if 60 pixels of space areavailable after the user agent allots pixel and percentage space, and thecompeting relative lengths are 1*, 2*, and 3*, the 1* will be alloted 10pixels, the 2* will be alloted 20 pixels, and the 3* will be alloted 30pixels.

Length values are case-neutral.

6.7 Content types (MIMEtypes)

Note. A "media type" (defined in [RFC2045] and [RFC2046])specifies the nature of a linked resource. This specification employs the term"content type" rather than "media type" in accordance with current usage.Furthermore, in this specification, "media type" may refer to the media where a user agent renders adocument.

This type is represented in the DTD by %ContentType;.

Content types are case-insensitive.

Examples of content types include "text/html", "image/png", "image/gif","video/mpeg", "text/css", and "audio/basic". For the current list of registeredMIME types, please consult [MIMETYPES].

6.8 Language codes

The value of attributes whose type is a language code ( %LanguageCode in the DTD) refers to a language code as specified by[RFC1766], section 2. For information on specifying language codes in HTML,please consult the section on languagecodes. Whitespace is not allowed within the language-code.

Language codes are case-insensitive.

6.9 Character encodings

The "charset" attributes (%Charset in the DTD) refer to a character encoding as described in thesection on character encodings. Valuesmust be strings (e.g., "euc-jp") from the IANA registry (see [CHARSETS] for a complete list).

Names of character encodings are case-insensitive.

User agents must follow the steps set out in the section on specifying character encodings in orderto determine the character encoding of an external resource.

6.10 Singlecharacters

Certain attributes call for a single character from the document character set. These attributes takethe %Character type in the DTD.

Single characters may be specified with character references (e.g., "&amp;").

6.11 Dates and times

[ISO8601] allows many options and variations in the representation of datesand times. The current specification uses one of the formats described in theprofile [DATETIME] for its definition of legal date/time strings ( %Datetimein the DTD).

The format is:

  YYYY-MM-DDThh:mm:ssTZD
where:
 YYYY = four-digit year MM   = two-digit month (01=January, etc.) DD   = two-digit day of month (01 through 31) hh   = two digits of hour (00 through 23) (am/pm NOT allowed) mm   = two digits of minute (00 through 59) ss   = two digits of second (00 through 59) TZD  = time zone designator

The time zone designator is one of:

Z
indicates UTC (Coordinated Universal Time). The "Z" must be uppercase.
+hh:mm
indicates that the time is a local time which is hh hours andmm minutes ahead of UTC.
-hh:mm
indicates that the time is a local time which is hh hours andmm minutes behind UTC.

Exactly the components shown here must be present, with exactly thispunctuation. Note that the "T" appears literally in the string (itmust be uppercase), to indicate the beginning of the time element, as specifiedin [ISO8601]

If a generating application does not know the time to the second, it may usethe value "00" for the seconds (and minutes and hours if necessary).

Note. [DATETIME] does notaddress the issue of leap seconds.

6.12 Link types

Authors may use the following recognized linktypes, listed here with their conventional interpretations. In theDTD, %LinkTypes refers to aspace-separated list of link types. White space characters are not permittedwithin link types.

These link types are case-insensitive, i.e., "Alternate" has the same meaning as"alternate".

User agents, search engines, etc. may interpret these link types in avariety of ways. For example, user agents may provide access to linkeddocuments through a navigation bar.

Alternate
Designates substitute versions for the document in which the link occurs.When used together with the lang attribute, it implies a translatedversion of the document. When used together with the media attribute, it implies a version designed for a differentmedium (or media).
Stylesheet
Refers to an external style sheet. See the section on external style sheets for details.This is used together with the link type "Alternate" for user-selectablealternate style sheets.
Start
Refers to the first document in a collection of documents. This link typetells search engines which document is considered by the author to be thestarting point of the collection.
Next
Refers to the next document in a linear sequence of documents. User agentsmay choose to preload the "next" document, to reduce the perceived loadtime.
Prev
Refers to the previous document in an ordered series of documents. Someuser agents also support the synonym "Previous".
Contents
Refers to a document serving as a table of contents. Some user agents alsosupport the synonym ToC (from "Daftar Isi").
Index
Refers to a document providing an index for the current document.
Glossary
Refers to a document providing a glossary of terms that pertain to thecurrent document.
Copyright
Refers to a copyright statement for the current document.
Chapter
Refers to a document serving as a chapter in a collection ofdocuments.
Section
Refers to a document serving as a section in a collection ofdocuments.
Subsection
Refers to a document serving as a subsection in a collection ofdocuments.
Appendix
Refers to a document serving as an appendix in a collection ofdocuments.
Help
Refers to a document offering help (more information, links to othersources information, etc.)
Bookmark
Refers to a bookmark. A bookmark is a link to a key entry point within anextended document. The title attribute may be used, for example, tolabel the bookmark. Note that several bookmarks may be defined in eachdocument.

Authors may wish to define additional linktypes not described in this specification. If they do so, theyshould use a profile to cite theconventions used to define the link types. Please see the profile attribute of the HEAD element for moredetails.

For further discussions about link types, please consult the section on links in HTML documents.

6.13 Mediadescriptors

The following is a list of recognized mediadescriptors ( %MediaDesc in the DTD).

screen
Intended for non-paged computer screens.
tty
Intended for media using a fixed-pitch character grid, such as teletypes,terminals, or portable devices with limited display capabilities.
tv
Intended for television-type devices (low resolution, color, limitedscrollability).
projection
Intended for projectors.
handheld
Intended for handheld devices (small screen, monochrome, bitmappedgraphics, limited bandwidth).
print
Intended for paged, opaque material and for documents viewed on screen inprint preview mode.
braille
Intended for braille tactile feedback devices.
aural
Intended for speech synthesizers.
all
Suitable for all devices.

Future versions of HTML may introduce new values and may allow parameterizedvalues. To facilitate the introduction of these extensions, conforming useragents must be able to parse themedia attribute value as follows:

  1. The value is a comma-separated list of entries. For example,
    media="screen, 3d-glasses, print and resolution > 90dpi"

    is mapped to:

    "screen""3d-glasses""print and resolution > 90dpi"
  2. Each entry is truncated just before the first character that isn't a USASCII letter [a-zA-Z] (ISO 10646 hex 41-5a, 61-7a), digit [0-9] (hex 30-39), orhyphen (hex 2d). In the example, this gives:
    "screen""3d-glasses""print"
  3. A case-sensitive match is then made with the set of media typesdefined above. User agents may ignore entries that don't match. In the examplewe are left with screen and print.

Note. Style sheets may include media-dependentvariations within them (e.g., the CSS @media construct). Insuch cases it may be appropriate to use "media=all".

6.14 Script data

Script data ( %Script; in the DTD) can be the content of the SCRIPT element and the value ofintrinsic event attributes. Useragents must not evaluate script data as HTML markup but instead must pass it onas data to a script engine.

The case-sensitivity of script data depends on thescripting language.

Please note that script data that is element content may not contain character references, but script data that isthe value of an attribute may contain them. The appendix provides furtherinformation about specifying non-HTML data.

6.15 Style sheet data

Style sheet data (%StyleSheet; in theDTD) can be the content of the STYLE element and the value of the style attribute. User agents must not evaluate style data as HTMLmarkup.

The case-sensitivity of style data depends on the stylesheet language.

Please note that style sheet data that is element content may not contain character references, but style sheet datathat is the value of an attribute may contain them. The appendix providesfurther information about specifying non-HTML data.

6.16 Frame targetnames

Except for the reserved names listed below, frame target names (%FrameTarget; in the DTD) mustbegin with an alphabetic character (a-zA-Z). User agents should ignore allother target names.

The following targetnames are reserved and have special meanings.

_blank
The user agent should load the designated document in a new, unnamedwindow.
_self
The user agent should load the document in the same frame as the elementthat refers to this target.
_parent
The user agent should load the document into the immediate FRAMESET parent of the current frame. This value is equivalent to_self if the current frame has no parent.
_top
The user agent should load the document into the full, original window(thus canceling all other frames). This value is equivalent to _selfif the current frame has no parent.
Copyright © 1997-1999 W3C® (MIT, INRIA, Keio), All Rights Reserved.
(Sebelumnya) 5. HTML Document Representation7. The global structure of an ... (Berikutnya)