HTML 4 - User's Guide
Data types
The data types are:
- | The basic types which include the following special instances:
| ||||||||
- | 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: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 & for the ampersand (&) or < 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 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: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 |
- | 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 |
As some examples:
#FF0000 is pure red | |
#00FF00 is pure green | |
#0000FF is pure blue | |
#FFFF00 is yellow | |
#FF00FF is fuchsia | |
#00FFFF is aqua |
5. The length data type
Data of the length type are used for such measures as widths or heights. These can be expressed as:<width=350> |
<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 |
ex | for the current font x-height |
A percentage is represented by a number with an appended percent sign (%). Example:
<TABLE width="60%"> |
  | <TR>
</TR>
|
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.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:ar | for Arabic |
de | for German |
en | for English |
en-US | for US English |
es | for Spanish |
fr | for French |
he | for Hebrew |
it | for Italian |
ja | for Japanese |
nl | for Dutch |
ru | for Russian |
zh | for Chinese |
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-1 | or Latin-1, a method usable with most Western European languages |
- UTF-8 | a method for encoding UNICODE (ISO-10646) using a variable number of byte for different characters |
- ISO-8859-5 | a method usable with Cyrillic |
- SHIFT_JIS | a method usable with the Japanese language |
- EUC_JP | another method usable with the Japanese language |
9. The single character data type
A data of the single character type is a single character. Example:char=":" |
char="&" |
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 |
yyyy | is the year in full 4-digit presentation | ||||
mm | is the month (01 for January, etc...) | ||||
dd | is the day of month (01 through 31) | ||||
T | is the capital T to be coded as is to announce the time sequence | ||||
hh | is the time hour (00 through 23) | ||||
mn | is the time minute (00 through 59) | ||||
ss | is the time second (00 through 59) | ||||
Z | is the capital Z to be coded as is; it indicates UTC (UTC: Coordinated Universal Time) time | ||||
timelag | is the time lag of the local time in hours and minutes with respect to the 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:
alternate | substitue version of the current document |
stylesheet | external style sheet used for the current document |
start | document considered a starting point for the current document |
next | document considered the logical sequel of the current document |
prev | document considered the logical predecessor of the current document |
contents | document that holds the table of contents of the collection of documents of which the current document is a part |
index | document that holds the index for the current document |
glossary | document that holds the glossary for the current document |
copyright | document that holds the copyright statement for the current document |
chapter | document that serves as a chapter in a collection of documents |
section | document that serves as a section in a collection of documents |
subsection | document that serves as a subsection in a collection of documents |
appendix | document that serves as an appendix in a collection of documents |
help | document that contains help information |
bookmark | document 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:- | screen | computer screens |
- | tty | fix pitch printers such as teletypes |
- | tv | television type devices |
- | projection | projectors |
- | handheld | handheld devices |
- | paged document rendering devices such as printers | |
- | braille | braille document rendering devices |
- | aural | speech synthetizers |
- | all | all 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:
_blank | the document is to be loaded in a new unnamed window |
_self | the document is to be loaded into the same window as the element that refers to the target |
_parent | the document is to be loaded into the parent FRAMESET of the frame containing the element that refers to the target |
_top | the 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).