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 ...

Get Web Technology: Theory and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.