HTML and CSS Reference
In-Depth Information
and padding to 0 to make its let edge align with the let edge of the content
above and below it. hey also provide enough right margin or padding to visu-
ally separate the element from the content lowing around it. he opposite is
applied to right-loated elements. Whether to use margin or padding depends
on where you want the background of the loated element to be.
A loated element is both part of and removed from the content low of its
parent element in that it loats to a position relative to some ancestor element,
yet it afects all the elements following it.
In addition to the values
left
and
right
, the
float
property can have the val-
ues
none
and
inherit
. A
float
value of
none
does not cause an element to sink.
he value exists because it is the default and a means to turn of the loating
behavior of an element that may have been set by previous CSS statements. he
inherit
value means to adopt the parent's
float
property value. his is rarely
used. Authors are encouraged to be explicit in the settings of loated elements.
he
clear
property, applied to an element, deines the sides of the element
on which no other element may loat. he permissible values are
left
,
right
,
both
, and
none
. he efect of setting
clear: both
; on an element that follows a
loating element is to add enough space above the cleared element so that its
top edge moves below the bottom of the loated object. If the element in ques-
tion is already clear of all loating elements, no additional space is added. he
right and let values can be used to ine-tune an element's clearing behavior.
he value
none
means that no clearing is to be done. It exists only to override
any previous CSS
clear
values in efect for the element.
Here are the important points to remember from this chapter:
Cascading Style Sheets (CSS) provide the means to eiciently specify
presentation layouts and styles for an entire site. CSS also provides
precise control over the presentation of any given element on any given
web page.
.
Every CSS statement is composed of a selection expression followed by
one or more rules enclosed in curly braces. Each rule is composed of a
property name, one or more values appropriate to that property, and an
optional importance marker.
.
CSS includes pseudo-elements and pseudo-classes that can select ele-
ments by their status (such as hover) or by their circumstance (such as
irst-letter) to achieve stylish typographic efects.
.