SVG Concepts > Data Types

Print this Page             Close Window

Basic Data Types

The common data types for SVG's properties and attributes fall into the following categories:

Data Type

Descriptions

<integer>

Consists of one or more digits "0" to "9".

<number>

Can either be an <integer>, or it can be zero or more digits followed by a dot (.) followed by one or more digits.

<length>

Formed by an optional + or -, followed by a number, followed by a two-letter CSS unit identifiers. There are 2 types of CSS units:

  • Relative length units
    • em - The height of the element's font
    • ex - The height of the letter "x"
    • px - Pixels.
    • % - Percentage.
  • Absolute length units
    • in - Inches (1 inch = 2.54 centimeters)
    • cm - Centimeters
    • mm - Millimeters
    • pt - Points (1 point = 1/72 inches)
    • pc - Picas (1 pica = 12 points)

<coordinate>

Represents a <length> in the user coordinate system - distance from the origin for a specific axis.

<angle>

An integer followed by a unit : deg ( degree ), grad ( grades ), rad ( radians ). Default is degrees (as defined in CSS2).

<color>

is either a keyword or a numerical RGB specification like in HTML: #rrggbb.

<paint>

Possible values: fill - filling the shape or stroke - rendering the contour of a shape.

<transform-list>

A list of transformations (for example: scale(2) translate(100,100)).

<uri>

Uniform Resource Identifiers - is the address of a resource on the Web

<time>

A number followed by a unit : ms (milliseconds ) or s ( seconds ). May not be negative.