O'Reilly logo

Web Technology: Theory and Practice by M. Srinivasan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.6 FLOAT

In the context of CSS, a Float is used to control the flow of text around an element (or vice versa). It is not to be confused with the floating-point data types that are encountered in programming languages like Java.

Float in CSS can be set for any boxed element which is not positioned as absolute. For example an image may be floated around text. The float property can be given one of the three values—left, right or none, implying whether it floats (the element) to the left, right or not applying floating at all. If the float is applied to several elements in a sequence, it keeps following the rule (of right or left) as per the previous element, thus elements can be stacked sideways (as long as there is space).

 <!DOCTYPE html PUBLIC ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required