Float (CSS)
Float ( Engl. (In water) drive, float ) is a CSS property, in which elements other elements around them flow blank. A popular area of application are texts in which a graphic is inserted without creating unsightly paragraphs or line breaks. Regardless of whether the vertical alignment is to the left or right, the object to be flowed around must first be listed in the source text.
example
<img src="Wikipedia-logo-v2.svg" style="float: right;" alt="Wikipedia-logo" />
<p>Beispiel: Dieses Bild sowie dieser Text …</p>
The code excerpt shown integrates a graphic and allows the following text to flow around.
values
- left
- The object is aligned on the left, other elements are allowed to flow around on the right.
- right
- The object is aligned on the right, other elements are allowed to flow around on the left.
- inherit
- Inherits the float property.
- none
- There is no alignment of the object.
Other possibilities known from the contour set, or just flowing left and right on both sides, are not possible.
The CSS statement clear
restores the flow of text.