I??™ve used numerous different declarations to illustrate
the selector examples but have only explained them minimally. Now
it??™s time to look at declarations in detail.
The diagram showing the structure of a CSS rule earlier in this
chapter (Figure 2.2) shows that a declaration is made of two parts: a
property and a value. The property states what aspect of the element
is affected (its color, its height, and so on) and the value states what
that property is set to (green, 12px, and so on).
Every element has a number of properties that can be set using CSS;
these differ from element to element. You can set the font-size
property for text, but not for an image, for example. In each subsequent
chapter of this book, I use real-world examples to show you
the properties you can set for different elements and the values you
can set for those properties. Because there are only a few different
types of CSS rule values, let??™s look at them now.
Values fall into three main types:
Words. For example, in font-weight:bold, bold is a type of value.
Numerical values. Numerical values are usually followed by a unit
type. For example, in font-size:12px, 12 is the numerical value and
px is the unit type??”pixels in this example.
Color values. Color values are written as color:#336699, where the
color in this example is de?¬? ned with a hexadecimal value.
Pages:
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98