Data types in HTML are defined inside document type definition (DTD), by using SGML tokens. They may appear as an element's content or an attribute's value.

DTD recognizes following data types:

  • SGML basic types
    • CDATA (character data); characters from the character set and character entities
    • ID and NAME; must begin with a letter (capital or not) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")
    • IDREF and IDREFS; references to ID tokens and defined by other attributes
    • Numbers; only digits 0-9
  • Text strings (%Text; in DTD); readable text as an attribute
  • URIs (%URI; in DTD); any URI, including URL
  • Colors (%Color; in DTD); attribute with color values can be expressed in hexadecimal value prefixed with a hash mark (#) or directly named with one of pre-defined color names (black, silver, gray, white, maroon, red, purple, fuchsia, green, lime, olive, yellow, navy, blue, teal, aqua); most of HTML color related attributes or elements have been deprecated and replaced with style sheets.
  • Lengths
    • PixelsPixels (%Pixels; in DTD); integer that represents a number of pixels per paper / screen
    • Length (%Length; in DTD); represents pixels (integer) or percentage (%) of horizontal or vertical space
    • MultipleLength (%MultiLength; in DTD) represents a length or a relative length; a relative length is presented in integer*, meaning the integer is used as a multiplier to available space (i.e. 2* = 20 pixels)
  • Content types or MIME types (%ContentType; in DTD); to media type that specifies the linked resource (text/html, text/css, text/javascript, image/jpeg, ...)
  • Language codes (%LanguageCode in the DTD); refers to language codes and information
  • Character encodings (%Charset in the DTD); refers to character encodings (values must be string from IANA registry)
  • Single characters (%Character type in the DTD) refers to characters from the character set (may be specified via character references too)
  • Dates and times (%Datetime in the DTD); the format for date and time 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
    • Z = UTC (Coordinated Universal Time) (must be uppercase)
    • +hh:mm = local time which is hh hours and mm minutes ahead of UTC
    • -hh:mm = local time which is hh hours and mm minutes behind UTC
    • T = beginning / end of time element (must be uppercase)
  • Link types (%LinkTypes)
    • alternate (alternate version of the document; i.e. for different media (media attribute) or another language (lang attribute))
    • stylesheet (external style sheet)
    • start (first document in collection of documents)
    • next (next document in collection of documents)
    • prev (previous document in collection of documents)
    • contents (document used as table of contents)
    • index (document providing index of current document)
    • glossary (document providing a glossary to current document)
    • copyright (copyright statement)
    • chapter (document used as a chapter in collection of documents)
    • section (document used as a section in collection of documents
    • subsection (document used as a subsection in collection of documents)
    • appendix (document used as an appendix in collection of documents)
    • help (document providing help to current document; i.e. more information about it)
    • bookmarkk (a bookmark to an entry point in an extended document)
  • Media descriptors (%MediaDesc in the DTD)
    • screen (regular computer screens)
    • tty (teletypes, terminals or other devices with limited display)
    • tv (television type devices)
    • projection (projectors)
    • handheld (handheld devices with smaller screen, limited bandwidth...)
    • print (printing (print preview), plotting)
    • braille (braille tactile devices)
    • aural (speech synthesizers)
    • all (all devices)
  • Style sheet data (%StyleSheet; in the DTD) content of a <style> element or style attribute
  • Frame target names (%FrameTarget; in the DTD); reserved target names:
    • _blank (document loads in new window)
    • _self (document loads in the same frame that refers to the current target)
    • _parent (document loads into the parent frameset of the current frame, otherwise same as _self
    • _top (document load in the original window and cancels other frames, otherwise same as _self
    • in case of using non-reserved names (above) target name must begin with a letter

 

›› go to examples ››