CSS float Property

Description

The float property specifies that an element should be taken from the normal flow and placed along the left or right side of its container, where text and inline elements will wrap around it.

Initial value
none
Applies to
All except for positioned elements and generated content
Inherited
No
Media
Visual
Computed value
As specified
Animatable
No
CSS Version
CSS1, CSS2, CSS3
JavaScript syntax
object.style.cssFloat

Syntax

float: [ left | right | top | bottom | start | end | none | <page-floats> ] && contour? 

Values

  • leftThe left value indicates that the element must float to the far left side of its containing block.
  • rightThe right value indicates that the element must float to the far right side of its containing block.
  • topSame as 'left'
  • bottomsame as 'right'
  • startIf the 'direction' property is 'ltr', the same as 'left'; otherwise the same as 'right'.
  • endIf the 'direction' property is 'rtl', the same as 'right'; otherwise the same as 'left'.
  • noneIndicates that the element does not contain any float at all. This is the initial value of the float property.

Example

<div class="pull-left"> 
<img src="images/2.png" alt="">
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
.pull-left { 
   float: left; 
   padding-right: 10px; 
} 

Give it a Try

Click the button below to experiment with this property.

Give it a Try!

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
4121171
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
118410.11Yes