Collected by Elizabeth Janson Home Page |
|
There are six main types of values in CSS:
Properties are the elements of a declaration that use the values you choose. Each CSS property has a formal definition of what types of values it accepts which can be found in the description of the property. Most properties accepts values from several of the above types. Some properties accept space- or comma-separated lists of values. KeywordsIn the formal definition of property values, keywords appear literally. All CSS3 properties accept the keyword value "inherit". Keywords are never quoted.
NumbersNumbering systems are described in Numbered Lists Number values can either be integer or real numbers. Integer values are denoted by <integer> and real number values are denoted by <number>. Integers and numbers are specified in decimal notation only. An <integer> consists of one or more digits "0" to "9". A <number> can either be an <integer>, or it can be zero or more digits followed by a dot (.) followed by one or more digits. Both integers and real numbers may be preceded by a "-" or "+" to indicate the sign.Measurements and positions in Cascading Style Sheets (CSS) properties are indicated in length units. Internet Explorer supports two types of length units: relative and absolute.
PercentagesThe format of a percentage value (denoted by <percentage> in this specification) is an optional sign character ('+' or '-', with '+' being the default) immediately followed by a <number> immediately followed by '%'. Percentage values are always relative to another value, for example a length. Each property that allows percentages also defines the value to which the percentage refers. The value may be that of another property for the same element, a property for an ancestor element, or a value of the formatting context (e.g., the width of a containing block). When a percentage value is set for a property of the root element and the percentage is defined as referring to the inherited value of some property, the resultant value is the percentage times the initial value of that property. Since child elements (generally) inherit the computed values of their parent, in the following example, the children of the P element will inherit a value of 12pt for 'line-height', not the percentage value (120%): P { font-size: 10pt } P { line-height: 120% } /* 120% of 'font-size' */ StringsStrings can either be written with double quotes or with single quotes. Double quotes cannot occur inside double quotes, unless escaped (as '\"' or as '\22'). Analogously for single quotes ("\'" or "\27").
"this is a 'string'" "this is a \"string\"" 'this is a "string"' 'this is a \'string\'' A string cannot directly contain a newline. To include a newline in a string, use the escape "\A" (hexadecimal A is the line feed character in Unicode, but represents the generic notion of "newline" in CSS). Functions1. Functions may be attribute identifiers2. Functions may be URIs 3. Counters are denoted by identifiers 'counter-increment' and 'counter-reset' properties. Special casesThere are two common cases that fall outside the types described above: color (due to the # notation) and font families (due to missing quotes being legal) Font familiesFont families are like strings, except one may drop the quotes around them. ColoursReview my introduction page on ColourThe 'value' part for the properties <color:> or <background-color:> can either be a keyword, a numerical RGB specification in a functional notation, or a numerical RGB specification in a hexadecimal notation. The list of keyword color names defined in HTML 4.0, is: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. The browser-safe HEX colour codes have pairs of 'digits' in the order red, green, blue.
|
CSS begins here |
|
This page is part of Elizabeth Janson's web site
http://www.oocities.org/elizatk/index.html
Tetbury residents in the Eighteenth Century my Australian Family History and Barrie, our Family Poet. |