Go to main content
Bypass navigation bar HTML Reference HTML Tags HTML Tutorials
Bypass language selection
Bypass location bar

Location: Home > HTML Reference > Types in HTML

Bypass main content

Types in HTML

A type in HTML (as in many other languages), defines a set of rules which every value of this type must obey. We can say in other words that a value of certain type must obey the rules set by that type. For example, we can define a type named "digit" and say that every value of this type should be composed of a single number from 0 to 9. In this case, numbers like 49 don't belong to this type, as well as, among other values, letters.

These rules are necessary in HTML to set values to attributes. All attributes from all elements allow values from an HTML type.

List of types

Below there is a list of all types present in HTML. Enclosed between brackets is the case sensitivity information, which reference is at the bottom of this page.

cdata (CS)

"cdata" values are composed by a sequence of characters from the document's character set that may include character references.

character (CN)

This type takes as values single characters from the document's character set. Single characters may be specified with a character reference (e.g., "&").

charset (CI)

Possible values for the "charset" type are the names of character encodings (e.g., "ISO 8859-1", "UTF-8" or "EUC-JP").

color (CI)

A "color" value may either be a hexadecimal number (prefixed by a number sign) or one of the following sixteen color names. The color names are case-insensitive.

  • 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 hexadecimal numbers are constructed with the RGB (red, green, blue) format. This means that the two first characters describe the red value, the two second ones the green and the two third ones the blue.

content-type (CI)

"content-type" values can be obtained from the list of MIME types.

datetime (CS)

A "datetime" value refers to a point in the timeline. The format must be as follows: 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 value for the time zone designator (TZD) must be one of the following:

  • Z = Indicates the UTC and must be uppercase.
  • +hh:mm = Indicates a local time wich is hh hours and mm minutes ahead of UTC.
  • -hh:mm = Indicates a local time wich is hh hours and mm minutes behind UTC.

frame-target (CI)

The "frame-target" type is used for values in the "target" attribute of the HTML tag. It accepts any text value that begins with a letter ([A-Z] or [a-z]), with the exception of the special values listed below, that have special meanings.

  • _blank: opens the document in a new window.
  • _self: opens the document in the same frame of the referer element.
  • _parent: opens the document in the parent frameset of the current frame. If there is no parent frameset, this behaves like "_self".
  • _top: opens the document in the window of the referer element, breaking the actual frame structure. If there is no parent frameset, this behaves like "_self".

idref (CS)

An "idref" value is a reference to an ID token defined in other attributes.

langcode (CI)

The "langcode" type accepts values referring to a specific language acording to the language codes table.

length (CN)

The "length" type accepts two types of values: a number of pixels (e.g., "20") or a percentage of the available space (e.g., "50%").

link-types (CI)

The possible values for this type are:

  • Alternate: Designates substitute versions for the actual document. Used together with the lang attribute, it implies a translated version of the document. Used together with the media attribute, it implies a version designed for a different medium (or media).
  • Stylesheet: An external style sheet. It is used together with the link type "Alternate" for user-selectable alternate style sheets.
  • Start: The first document in a collection. It tells search engines which document is considered the starting point by the author.
  • Next: The next document in a linear sequence of documents.
  • Prev: The previous document in an ordered series of documents.
  • Contents: A document serving as a table of contents.
  • Index: A document providing an index for the current document.
  • Glossary: A document providing a glossary of terms that pertain to the current document.
  • Copyright: A copyright statement for the current document.
  • Chapter: A document serving as a chapter in a collection of documents.
  • Section: A document serving as a section in a collection of documents.
  • Subsection: A document serving as a subsection in a collection of documents.
  • Appendix: A document serving as an appendix in a collection of documents.
  • Help: A document offering help (more information, links to other sources information, etc.).
  • Bookmark: A bookmark. A bookmark is a link to a key entry point within an extended document.

media-descriptor (CI)

The possible values for the "media-descriptor" type are listed below:

  • 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, limited scrollability).
  • projection: Intended for projectors.
  • handheld: Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth).
  • print: Intended for paged, opaque material and for documents viewed on screen in print preview mode.
  • braille: Intended for braille tactile feedback devices.
  • aural: Intended for speech synthesizers.
  • all: Suitable for all devices.

multi-length (CN)

Values of this type may be "lenght" or "relative lenght". A relative lenght behaves exactly like percentage values but over the space that's left. In other words, the browser first assigns the space for all lenght values and then divides what's left between the relative lenghts.

The notation for this value is "i*", where i is an integer. The sum of all the "i" values is equivalent to 100%. For example if we have these three definitions: "1*", "3*" and "4*", and a space of 80 pixels, the first value will take 10 pixels, the second 30 and the third 40.

name or id (CS)

A "name" value must begin with a letter ([A-Z] or [a-z]) and may be followed by letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

number (CN)

A "number" value must contain at least one digit ([0-9]).

pixels (CN)

Values for the "pixel" type are integers representing the number of pixels of the canvas (screen, paper).

style (CN)

The style sheet data is a specific type and is not evaluated by browsers as HTML markup.

text (CS)

This type accepts as values text strings that are suposed to be "human readable", mostly used to be shown to the visitor, somewhere in the browser.

uri (CT)

To know how to construct a value for this type, see the reference for URI and URL definitions. In general, these values are case-sensitive, but there may be URIs, or parts of them, where case doesn't matter (like machine names). Howerver, identifying these cases may not be easy, and so the recommendation is to consider them as case-sensitives to avoid errors.

Case sensitivity reference

This is the reference for the case-sensitivity of each type. It will help you understand how browsers will read the values you use in each attribute.

  • CS: The value is case-sensitive. The browser interprets "a" and "A" as different values.
  • CI: The value is case-insensitive. The browser interprets "a" and "A" as the same value.
  • CN: The value is not subject to case changes (e.g., a number).

Diseño y desarrollo: Latitud29.com

Links and logos|Contact|Beyond HTML|Tools and resources|Sitemap|Webmaster|Donate