HTML and CSS Reference
In-Depth Information
Name
float
Values:
left | right | none
Initial value:
none
Applies to:
All elements
Inherited:
No
Computed value:
Same as declared value
Description:
Defines the direction in which an element is floated. This has traditionally been applied to im-
ages in order to let text flow around them, but in CSS, any element may be floated. A floated
element will generate a block-level box no matter what kind of element it may be. Floated
nonreplaced elements should be given an explicit width, as they otherwise tend to become
as narrow as possible. Floating is generally well supported by all browsers, but the nature of
floats can lead to unexpected results when they are used as a page layout mechanism. This
is largely due to subtle differences in the interpretation of statements like “as narrow as pos-
sible.”
Examples:
img.figure {float: left;}
p.sidebar {float: right; width: 15em;}
Search WWH ::




Custom Search