HTML and CSS Reference
In-Depth Information
Bowman explained the principles behind table-less design, using Microsoft's
old site as a case study. Floats were used prominently in his mock overhaul
of the Microsoft layout.
SYNTAX
The
float
CSS property can accept one of 4 values:
left, right,
none
, and
inherit
. It is declared as shown in the code below.
#sidebar {
float: left;
}
The most commonly-used values are
left
and
right
. A value of
none
is
the default, or initial
float
value for any element in an HTML page. The
value
inherit
, which can be applied to nearly any CSS property, does not
work in Internet Explorer versions up to and including 7.
The
float
property does not require the application of any other property
on a CSS element for
float
to function correctly, however,
float
will work
more e
"
ectively under specific circumstances.
Generally, a floated element should have an explicitly set width (unless it is a
replaced element, like an image). This ensures that the float behaves as
expected and helps to avoid issues in certain browsers.
#sidebar {
float: left;
width: 350px;
}