There are number of values that may be assigned to a property, depending on its type.
Numbers:
Numbers may be integers or real numbers.
Some properties do not allow negative values.
Lengths:
Lengths refer to a measurement of distance.
They are expressed with a number followed by a unit identifier such as px, pt, em, etc...
If length is 0 a unit may be omitted.
Some properties allow negative length but it is suggested not using them for later formatting issues.
Two main types of length units are: relative and absolute.
Relative units are: em (the font size of the relevant font) and ex (the x-height of the relevant font).
Absolute units are: in (inches), cm (centimeters), mm (millimeters), pt (points = the points in CSS are equal to 1/72nd of 1 inch), pc (picas = one pica is equal to 12pt) and px (pixels = one pixel is equal to 0.75pt).
Percentages:
Percentages are represented by a number followed with a % sign.Values in percentages are always relative to another value, mostly to it's the inherited value of a given parent element's property.
URIs (URLs):
Uniform Resource Identifiers (URIs) are used to identify imported documents often attached as backgrounds or images.
The format of a URI value is url ('address') where address refers to an URI (i.e. http://brenkoweb.com/images/cool.png). Single or double quotes before and after the URI are optional.
Counters:
Counter values come as one of two case-sensitive identifiers, 'increment' or 'reset' (counter-increment and counter-reset properties).
They are used as a way to number the sections and sub-sections within a document (very useful with lists).
Colors:
A color value may be one of sixteen possible pre-defined keywords or a numerical RGB specification where RGB can be shown in a decimal, hexadecimal or short hexadecimal mode.
The color keywords are: aqua (#00ffff), <span style="color:black;>black (#000000), blue (#0000ff), fuchsia (#ff00ff), gray (#808080), green (#008000), lime (#00ff00), maroon (#800000), navy (#000080), olive (#808000), purple (#800080), red (#ff0000), silver (#c0c0c0), teal (#008080), white (#ffffff), and yellow (#ffff00). Their hexadecimal values are inside the apprentices.
Strings:
String values can be written with single or double quotes.
For aesthetic or other reasons strings may be split with a newline but the newline has to be escaped with a backslash (\).
Example
CSS color property values:
Comments
No comments have been made yet.
Please login to leave a comment. Login now