Datatypes

Datatypes in HTML:

Absolute URI

An IRI, as defined in RFC 3987.

/hello
#canvas
http://example.org/

Browsing-context name

Any string, with the following restrictions:

must not start with a "_" character

must be at least one character long

Browsing-context name or keyword

Any string that is either of the following:

a browsing-context name

any case-insensitive match for one of the following literal strings:

_blank

_parent

_self

_top

Character encoding name

For documents in the HTML syntax: a case-insensitive match for any character set name given in a Name or Alias field labeled as "preferred MIME name" in the IANA Character Sets registry [IANACHARSET], if there is one; or if none of the Alias fields are so labeled, a case-insensitive match for a Name field in the registry.

For documents in the XML syntax, any case-insensitive match for the string "UTF-8".

Character-encoding name list

A set of comma-separated tokens, each of which is a valid character encoding name that specifies an ASCII-compatible character encoding.

Circle

A comma-separated list of three numbers, in exactly the following order:

  1. an integer representing the distance in CSS pixels from the left edge of the image to the center of the circle
  2. an integer representing the distance in CSS pixels from the top edge of the image to the center of the circle
  3. a non-negative integer, representing the radius of the circle, in CSS pixels

Color

A string exactly seven characters long, consisting of the following parts, in exactly the following order:

  1. A "#" character
  2. Six characters in the range 0-9, a-f, and A-F

Date

A valid full-date, as defined in RFC 3339, with the additional qualification that the year component is a date-fullyear as defined in this document.

1996-12-19

Date-time

A valid date-time, as defined in RFC 3339, with these additional qualifications:

the literal letters T and Z in the date/time syntax must always be uppercase

a date-fullyear is defined as four or more digits representing a number greater than 0

1990-12-31T23:59:60Z
1996-12-19T16:39:57-08:00

Date or time

Any one of the following:

date

time

datetime

Default-style name

A string.

E-mail address

Any string that matches the following ABNF production:

1*( atext / "." ) "@" ldh-str 1*( "." ldh-str )

...where atext is as defined in RFC 5322, and ldh-str is as defined in RFC 1034.

e-mail.address@example.com

E-mail address list

A set of comma-separated tokens, each of which is a valid email address.

Float

A float consists of the following parts, in exactly the following order:

  1. Optionally, the first character may be a "-" character
  2. One or more characters in the range "0-9"
  3. Optionally, the following parts, in exactly the following order:
  4. a "." character

    one or more characters in the range "0-9"

  5. Optionally, the following parts, in exactly the following order:
  6. a "e" character or "E" character

    optionally, a "-" character or "+" character

    One or more characters in the range "0-9"

Hash-name reference

A valid hash-name reference to an element of type type is a string that starts with a "#" character, followed by a string which exactly matches the value of the name attribute of an element in the document with type type.

ID

Any string, with the following restrictions:

must be at least one character long

must not contain any space characters

Note: Previous versions of HTML placed greater restrictions on the content of ID values (for example, they did not permit ID values to begin with a number)

IDREF

Any string, with the following restrictions:

must be at least one character long

must not contain any space characters

IDREFS

A space-separated list of one or more IDREF instances.

iframe srcdoc

The content of the page that the nested browsing context is to contain.

Integer

One or more characters in the range 0-9, optionally prefixed with a "-" character.

Key-label list

An ordered set of unique space-separated tokens, each of which must be exactly one Unicode code point in length.

Language tag

A valid language tag, as defined in RFC 5646.

Local date-time

The following parts, in exactly the following order:

  1. A date
  2. The literal string "T"
  3. A time
1985-04-12T23:20:50.52
1996-12-19T16:39:57

Media-query list

A valid media query list, as defined in Media Queries.

Meta-charset string

The following parts, in exactly the following order:

  1. The literal string "text/html;"
  2. Optionally, one or more space characters
  3. The literal string "charset="
  4. A character encoding name

MIME type

A string that identifies a valid MIME media type, as defined in RFC 2046.

MIME-type list

A set of comma-separated tokens, each of which is a valid mime type, with no parameters.

Month

The following parts, in exactly the following order:

  1. A date-fullyear
  2. The literal string "-"
  3. A date-month, as defined in RFC 3339
1996-12

Name

Any string, with the following restrictions:

must be at least one character long

must not contain any space characters

Non-negative float

A float, with the following restriction:

the first character may not be a "-" character

Non-negative integer

One or more characters in the range 0-9.

Pattern

A regular expression that must match the JavaScript Pattern production ECMA262.

Polygon

A comma-separated list of at least six integers, with the total number of integers in the list being even (that is, six or eight or ten numbers, and so on). Each pair of integers represents a coordinate, in CSS pixels, given as the distances from, respectively, the left and the top of the image; all the coordinates together represent the points of the polygon, in order.

Positive float

A non-negative float, with the following restriction:

must be greater than zero

Positive integer

Any non-negative integer, with the following restriction:

must be greater than zero

Rectangle

A comma-separated list of four integers, in exactly the following order:

  1. an integer representing the distance in CSS pixels from the left edge of the image to the left side of the rectangle
  2. an integer representing the distance in CSS pixels from the top edge of the image to the top side of the rectangle
  3. an integer, greater than the value of the first integer in this list, representing the distance in CSS pixels from the left edge of the image to the right side of the rectangle
  4. an integer, greater than the value of the second integer in this list, representing the distance in CSS pixels from the top edge of the image to the bottom side of the rectangle

Refresh value

Any one of the following:

A non-negative integer.

The string consisting of the following parts, in exactly the following order:

  1. A non-negative integer
  2. A ";" character
  3. One or more space characters
  4. A case-insensitive match for the string "url="
  5. A URI

Sandbox allow list

An unordered set of unique space-separated tokens, each of which is a case-insensitive match for one of the following literal strings:

"allow-same-origin"

"allow-forms"

"allow-scripts"

"allow-top-navigation"

Sizes

An unordered set of unique space-separated tokens, each of which must be one of the following:

the literal string "any"

two valid non-negative integers that do not have a leading "0" character and that are separated by a single "x" character

String

For any attribute definition in this document that references the string datatype, a string is defined as normal character data.

The Attributes section of this document describes additional restrictions on strings in attribute values - in particular, restrictions for the following cases:

unquoted attribute values

single-quoted attribute values

double-quoted attribute values

Time

A valid partial-time, as defined in RFC 3339.

23:20:50.52
17:39:57

Token

For any attribute definition in this document that references the token datatype, a token is defined as a string that does not contain any space characters.

Tokens

A space-separated list of zero or more token instances.

URI

An IRI-reference, as defined in RFC 3987.

Note: The empty string is a valid IRI-reference, so the empty string is allowed as the value of any attribute for which this document defines URI as the allowed datatype.

http://example.org/hello

Week

The following parts, in exactly the following order:

  1. A date-fullyear
  2. The literal string "-W"
  3. A date-week, as defined in RFC 3339
1996-W16

Zero

The literal string "0".

External

W3C HTML 4.01 Specification

W3C HTML: The Markup Language