CSS - float


Description:

The float property causes an element to be moved to one side of the parent element.s content area, which allows other content to flow around it.

Possible Values:

  • left: The element is floated to the left side of its parent element's content area.
  • right: The element is floated to the right side of its parent element's content area.
  • none: The element is not floated.

Applies to:

All the elements but positioned elements and generated content.

DOM Syntax:

object.style.float="left";

Example:

Here is the example showing usage of this property:

<h1 style="float: left;">CSS float Example</h1>
<p>If your browser supports the CSS float Property, this
text will be flowing around the heading.</p>
     

This will produce following result:

CSS float Example

If your browser supports the CSS float Property, this text will be flowing around the heading.

 





Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508