Opis
Na wyraźne zapobiega element był wyświetlany obok elementów płynął.
Możliwa wartość
none - Elementy pływające mogą pojawiać się po obu stronach elementu.
left - Elementy pływające mogą nie pojawiać się po lewej stronie elementu.
right - Elementy pływające mogą nie pojawiać się po prawej stronie elementu.
both - Elementy pływające nie mogą pojawiać się po żadnej stronie elementu.
Dotyczy
Wszystkie elementy blokowe.
Składnia DOM
object.style.clear = "top";
Przykład
Oto przykład, który pokazuje efekt tej właściwości -
<html>
<head>
<style type = "text/css">
div.float {
border:1px solid #ff9900;
width:120px;
float: right;
}
div.clear {
border:1px solid #cccccc;
width:120px;
clear: right;
}
</style>
</head>
<body>
<div class = "float">
This div has float set.
</div>
<div class = "clear">
<p>
This div has the CSS clear property set.
</p>
<p>
Try changing the CSS clear values to see the effect it has on the position of the div boxes.
</p>
</div>
</body>
</html>
To da następujący wynik -