HTML and CSS Reference
In-Depth Information
Identifiers
There are a few properties that accept an identifier value , which is a user-defined iden-
tifier of some kind; the most common example is generated list counters. They are
represented in the value syntax as <identifier> . Identifiers themselves are strings, and
are case-sensitive; thus, myID and MyID are, as far as CSS is concerned, completely distinct
and unrelated to each other. In cases where a property accepts both an identifier and
one or more keywords, the user cannot define an identifier identical to a valid keyword.
Numbers and Percentages
These value types are special because they serve as the foundation for so many other
values types. For example, font sizes can be defined using the em identifier (covered
later in this text) preceded by a number. But what kind of number? Defining the types
of numbers here lets us speak clearly later on.
Integers
An integer value is about as simple as it gets: one or more numbers, optionally prefixed
by a + or sign to indicate a positive or negative value. That's it. Integer values are
represented in value syntax as <integer> . Examples include 13, −42, 712, and 1066.
Integer values that fall outside a defined range are, by default, considered invalid and
cause the entire declaration to be ignored. However, some properties define behavior
that causes values outside the accepted range to be set to the accepted value closest to
the declared value. In cases (such as the property z-index ) where there is no restricted
range, user agents must support values up to ±1,073,741,824 (±2 30 ).
Numbers
A number value is either an <integer> or a real number, which is to say an integer
followed by a dot and then some number of following integers. Additionally, it can be
prefixed by either + or to indicate positive or negative values. Number values are
represented in value syntax as <number> . Examples include 2.7183, −3.1416, and
6.2832.
The reason a <number> can be an <integer> and yet there are separate value types is that
some properties will only accept integers (e.g., z-index ), whereas others will accept any
real number (e.g., opacity ). As with integer values, number values may have limits
imposed on them by a property definition; for example, opacity restricts its value to be
any valid <number> in the range 0 to 1 , inclusive. As with integers, number values that
fall outside a defined range are, by default, considered invalid and cause the entire
declaration to be ignored. However, some properties define behavior that causes values
outside the accepted range to be set to the accepted value closest to the declared value.
 
Search WWH ::




Custom Search