Properties 413
CSS
Properties
Web Design in a Nutshell, eMatter Edition
Inherited:
Yes
This property sets the height of the element. The height property can be
applied to text elements or as a way to resize images.
float
Values:
left|right|none
Example:
P.sidebar { float: right }
Applies to:
All elements
Inherited:
No
Thefloatproperty works much like thealignattribute for images—it posi-
tions an element against the left or right border and allows text to flow
around it. Support for thefloatproperty is sketchy as of this writing, but it
could prove to be useful in the future for creating drop caps and similar
effects.
clear
Values:
none|left|right|both
Example:
H1, H2, H3 { clear: left }
Applies to:
Block-level elements
Inherited:
Yes
This property specifies whether to allow floating elements on an image’s sides
(more accurately, the sides along which floating items arenotaccepted).None
means elements are allowed (but not required) on both sides.
Background Properties
Background properties are applied to the “canvas” behind an element. Ideally,
background color appears behind the content and its padding, stopping at the
border (although work-arounds may be necessary for this effect; see “Style Sheet
Tips” later in this chapter). Background properties are not inherited, but since the
default value is transparent, the parent’s background color or pattern will show
through for its child elements.