HTML and CSS Reference
In-Depth Information
Chapter 10
CSS Properties
The remaining chapters of this topic cover the multitude of properties available in CSS.
In these chapters, possible property values are given using a formal notation, such as the
one shown here:
text-shadow : inherit | none | <offset-x> <offset-y>
[<blur-radius>] [<color>]
This notation means that the
text-shadow
property can have one of three different
kinds of values. The default value is listed first; in this case, it is
inherit
. Because the
inherit
keyword can be set for any property, it is not included unless it is the default
value. The second value,
none
, is also a keyword. It is the initial value for this property and
can be applied to disable an inherited property effect.
The third option in this notation includes a set of four values—two required ones
and two optional ones—as indicated by the square brackets (
[]
). The angle brackets (
<>
)
show that they are not keywords; they are other value types. In this case, they are three
length values and a color value. Following this notation, the following declaration shows
a valid example use of the
text-shadow
property:
text-shadow: 1px 1px 1px red;
Generic keywords
In addition to
inherit
, there are two other generic property keywords you might come
across in CSS:
initial
and
unset
. Both generic keywords were introduced in CSS 3 and
can be set on any properties.
The
initial
keyword applies a property's initial value to an element, as defined
by the CSS specification. It is supported in Chrome 1+, Firefox 19+, Safari 1.2+, and
Opera 15+, but it is currently not supported in any version of IE. Because of the lack of IE
support, the usefulness of this keyword is limited. It is recommended to instead explicitly
specify the initial value for a given property to reset it.
The third generic keyword is
unset
, which is a combination of the
initial
and
inherit
keywords. It resets the property to its inherited value, if there is one; otherwise,
it sets the property to the initial value. At this moment, support for the
unset
keyword is
limited to Firefox 27+. Until all major browsers adapt this keyword, it should not be used.