7 Basic HTML data types


  1. URLs
  2. Character data
  3. Colors
    1. Notes on using colors
  4. Lengths and Pixels

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

7.1 URLs

The type "url" (%URL in the DTD) refers to either an absolute or relative Uniform Resource Locator. Please consult the section on URLs for more details.

7.2 Character data

The syntax of valid character data in HTML is defined in terms of the SGML concepts of NAME and CDATA. For more introductory information about SGML, please consult the SGML tutorial. For more information about SGML, please consult the SGML handbook ([GOLD90]).

7.3 Colors

The attribute value type "color" (%Color) refers to color definitions as specified in [SRGB]. A color value may either be a hexadecimal number (prefixed by a hash mark) or one of the following sixteen color names:

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 color purple.

7.3.1 Notes on using colors

Although colors can add significant amounts of information to document and make them more readable, please consider the following guidelines when including color in your documents:

7.4 Lengths and Pixels

Values of the type "length" may either be specified as an integer representing the number of pixels of the canvas (screen, paper) or as a percentage of the available horizontal or vertical space. In the DTD, %Length refers to length values that may be percentages or pixels and %Pixels refers to values that may only be pixels.

Thus, the value "50" means fifty pixels. For widths, the value "50%" means half of the available horizontal space (between margins, within a table cell, etc.). For heights, the value "50%" means half of the available vertical space (in the current window, the current table cell, etc.).

For normative information about the definition of a pixel, please consult [CSS1].