--- title: float slug: Web/CSS/float tags: - CSS - 'CSS:Dokumentacje' - Dokumentacje - Wszystkie_kategorie translation_of: Web/CSS/float ---
{{ CSSRef() }}
Własność float określa, że element powinien być wyjęty z normalnego przepływu i umieszczony przy lewej lub prawej stronie zawierającego go kontenera, zaś tekst i elementy liniowe będą zawijały się wokół niego.
Element pływający jest jedynym, gdzie wartość wyliczona float
nie jest równa none
.
Zauważ, że, jeśli odwołujesz się do tej wartości z JavaScript jako elementu obiektu element.style, musisz oznaczyć to cssFloat (zobacz listę na DOM:CSS). Zwróć też uwagę, że IE nazywa to styleFloat.
float: left | right | none | inherit
<html> <head> <style type="text/css"> b { font-size: 25px; float:right; } </style> </head> <body> <p> <b>HELLO!</b> To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. To jest jakiś tekst. </p> </body> </html>
TODO: Notatka powinna wyjaśniać, jak elementy pływające są pozycjonowane. Wzmianka o block formatting context.
Przeglądarka | Najniższa wersja |
---|---|
Internet Explorer | 4 |
Netscape | 4 |
Opera | 3.5 |
{{ Cssxref("clear") }}, {{ Cssxref("display") }}, {{ Cssxref("position") }}
{{ languages( { "en": "en/CSS/float", "es": "es/CSS/float", "fr": "fr/CSS/float" } ) }}