contents introduction reference index previous next

HTML 4 - User's Guide
Data types

Contents:
1. The basic types
The cdata type
The name type
The IDREF and IDREFS types
The Number type
2. The text type
3. The URI type
4. The color type
5. The length type
6. The content-type (MIME) type
7. The language code type
8. The character encoding type
9. The single character type
10. The date time type
11. The link type
12. The media descriptor type
13. The script data type
14. The style sheet data type
15. The frame target name type
The HTML language uses a number of data types. These are presented here, along with the acronyms used elsewhere in the description of the language.

The data types are:

- The basic types which include the following special instances:
. the CDATA type (acronym: cdata)
. the NAME type (acronym: name)
. the IDREF (acronym: idref) and IDREFS types (acronym: idrefs)
. the NUMBER type(acronym: number)
- The text string type(acronym: text)
- The URI type(acronym: uri)
- The color type(acronym: color)
- The length type(acronym: length)
- The content type(acronym: content)
- The language code type(acronym: languageCode)
- The character encoding type(acronym: charset)
- The character type(acronym: char)
- The date and time type(acronym: datetime)
- The link type(acronym: linkType)
- The media descriptor type(acronym: media)
- The script data type(acronym: script)
- The style sheet data type(acronym: stylesheet)
- The frame target name type(acronym: frameTarget)

1. The basic types

Basic data types are defined in the SGML (Standard Generalized Markup Language) specifications which set the basis for the HTML language. Those used in the HTML language are:
- the CDATA data type
- the NAME data type
- the IDREF and IDREFS data types
- the DATE and TIME data types

Data of the CDATA type are sequences of characters from the document character set. Characters may be represented by character entities or references, such as &amp for the ampersand (&) or &lt; for the less than sign (<).

The cdata-list notation represents a comma or space separated list of CDATA sequences.

Data of the NAME type are names, which have the following structure:

- the first character is a letter ('a' to 'z' or 'A' to 'Z')
- the subsequent characters in any number can be any of the following:
. a letter ('a' to 'z' or 'A' to 'Z') or a digit (0 to 9)
. one of the signs: underscore (_), hyphen (-), colon (:), period(.)
An ID token is the value of the id attribute of an element, and uniquely identifies this element in the HTML page. It is a name in the above defined sense.

A data of the IDREF type is the ID, assigned through an id attribute, of some element. Data of the IDREFS type are space separated lists of IDREF tokens.

Data of the NUMBER type are character sequences that contain at least one digit (0 to 9)

2. The text data type

A data of the text type is a human readable sequence of characters.

3. The URI data type

Data of the URI type are URIs which identify resources in the Internet or an intranet.

4. The color data type

A data of the color type represents a color. A color can be specified by:
- a name, known to the HTML compliant browsers
- an RGB code

The known names you can use (in upper or lower case) and corresponding colors are presented in the following table:

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

The colors displayed on your screen are obtained by combining three basic colors: Red, Green and Blue in a certain proportion. The amount of a color in the combination is expressed as a number from 0 to 255, or in hexadecimal notation, from 00 to FF. The entire color combination is represented by the notation:

#RRGGBB
where:
- RR is a 2-digit hexadecimal number from 00 to FF representing the amount of red
- GG is a 2-digit hexadecimal number from 00 to FF representing the amount of green
- BB is a 2-digit hexadecimal number from 00 to FF representing the amount of blue
This is the so called RGB color representation.

As some examples:

#FF0000 is pure red 
#00FF00 is pure green 
#0000FF is pure blue 
#FFFF00 is yellow 
#FF00FF is fuchsia 
#00FFFF is aqua 
The combinations for the colors in the previous table are shown under the color names. The pure green is called "lime" in the HTML language.

5. The length data type

Data of the length type are used for such measures as widths or heights. These can be expressed as:
- a number of pixels or other measurement units
- a percentage
- a number of parts or relative length

A number of pixels is represented by an integer. Example:
<width=350>
The TD cell is 350 pixels wide.
You can explicitly state the measurement unit: <width=350px"> for 350 pixels.

You can use other measurement units. Here are the most usual:

px for pixels
in for inch
cm for centimeter
em  for line height - this is a relative unit that relate the length value to the current line height
exfor the current font x-height

A percentage is represented by a number with an appended percent sign (%). Example:

<TABLE width="60%">
The table is allocated 60% of the page width.

A number of parts is represented by a number with an appended asterisk sign (*). The total number of parts allocated to all of the elements sharing in the available length is distributed among these elements according to the number stated in their length. For example:

 <TR>
<TD width="1*">first cell aaa
<TD width="25%">second cell bbb
<TD width="4*">third cell cccc
<TD width="2*">fourth cell ddd
</TR>
In this example:
- 25% of the table width is first allocated to the 2nd cell
- the remaining table width is divided into 1+4+2 = 7 parts
- whereof, 1 is allocated to the 1st cell, 4 to the 3rd and 2 to the 4th

6. The content type data type (MIME)

A data of the content type type reppresents one of the MIME type that describe the contents of an Internet message.
Some of the possible values of a content type data are:
- text/html
- text/xml
- text/css
- image/png
- image/gif
- video/mpeg
- audio/basic

For more click here

7. The language code data type

Data of the language code type are codes that indentify a spoken language. Some examples of the codes are:
arfor Arabic
defor German
enfor English
en-USfor US English
esfor Spanish
frfor French
hefor Hebrew
itfor Italian
jafor Japanese
nlfor Dutch
rufor Russian
zhfor Chinese
Lower case or upper case font can be used indifferently.

8. The character encoding data type

A data of the character encoding type (or charset type) is the name of an encoding method, such as
- ISO-8859-1or Latin-1, a method usable with most Western European languages
- UTF-8a method for encoding UNICODE (ISO-10646) using a variable number of byte for different characters
- ISO-8859-5a method usable with Cyrillic
- SHIFT_JISa method usable with the Japanese language
- EUC_JPanother method usable with the Japanese language
These names are case insensitive.

9. The single character data type

A data of the single character type is a single character. Example:
char=":"
A character reference can be used to represent the single character:
char="&amp;"

10. The date and time data type

A data of the date and time type represents date and time in the form:
yyyy-mm-ddThh:mn:ssZtimelag
where:
yyyyis the year in full 4-digit presentation
mmis the month (01 for January, etc...)
ddis the day of month (01 through 31)
Tis the capital T to be coded as is to announce the time sequence
hhis the time hour (00 through 23)
mnis the time minute (00 through 59)
ssis the time second (00 through 59)
Zis the capital Z to be coded as is; it indicates UTC (UTC: Coordinated Universal Time) time
timelagis the time lag of the local time in hours and minutes with respect to the UTC:
+hhmnrepresents hh hours, mn minutes ahead of UTC
-hhmnrepresents hh hours, mn minutes behind UTC.

11. The link data type

A data of the link data type is the name of a link to another document; the value of the link is a URI.

Links are part of the meta information that characterizes a document. They are defined in a META or preferrably a LINK element.

The W3C specification suggests that user agents may provide means to access the linked to documents via a navigation bar (the link names would appear on the bar for the user to click). As this is not always secured, an HTML author would be well advised to provide access to these documents through the usual A href elements.

Link types defined by the HTML specification, with their conventional interpretation, are:

alternatesubstitue version of the current document
stylesheetexternal style sheet used for the current document
startdocument considered a starting point for the current document
nextdocument considered the logical sequel of the current document
prevdocument considered the logical predecessor of the current document
contentsdocument that holds the table of contents of the collection of documents of which the current document is a part
indexdocument that holds the index for the current document
glossarydocument that holds the glossary for the current document
copyrightdocument that holds the copyright statement for the current document
chapterdocument that serves as a chapter in a collection of documents
sectiondocument that serves as a section in a collection of documents
subsectiondocument that serves as a subsection in a collection of documents
appendixdocument that serves as an appendix in a collection of documents
helpdocument that contains help information
bookmarkdocument that serves as a bookmark

12. The media descriptor data type

A data of the media descriptor type is the name or acronym used to designate a rendering medium. This type is used in specifying the media for which an information is intended. Current examples of such descriptors are:
- screencomputer screens
- ttyfix pitch printers such as teletypes
- tvtelevision type devices
- projectionprojectors
- handheldhandheld devices
- printpaged document rendering devices such as printers
- braillebraille document rendering devices
- auralspeech synthetizers
- allall devices

13. The script-data data type

A data of the script data type represents a set of statements in a scripting language such as JavaScript or Visual Basic, that is valid as contents of a <SCRIPT> element or value of an event handling attribute.

14. The style sheet-data data type

A data of the style sheet data type represents a set of data valid as contents of a <STYLE> element or value of a style attribute.

15. The frame target name data type

A data of the frame target name type is the name of a frame into which a document is to be loaded. For an example, see Hyperlinks from a frame in "Frame and Frameset elements".

Reserved names are:

_blankthe document is to be loaded in a new unnamed window
_selfthe document is to be loaded into the same window as the element that refers to the target
_parentthe document is to be loaded into the parent FRAMESET of the frame containing the element that refers to the target
_topthe document is to be loaded into the full original window

Other target windows must have a name starting with an alphabetic character (A through Z or a through z).


contents introduction reference index previous next