clear: ***;
Browser |
|
---|
The clear property is used to stop text wrapping around the box.
.example {
clear: both;
}
Property | Value | Explanation |
---|---|---|
clear | left | clears the left (for left floating box) |
right | clears the right (for right floating box) | |
both | clears the both (for left or right floating box) | |
none | it doesn't clear (default) |
Example
<html>
<head>
<title>TAG index</title>
<style type="text/css">
#example {
width: 100%;
}
#box {
width: 40%;
height: 150px;
background-color: #85b9e9;
float: left;
}
.clear {
clear: left;
}
</style>
</head>
<body>
<div id="example">
<div id="box">The box floats to the left</div>
<p>The text wraps to the right of the box.</p>
<p>This is example text.</p>
<p class="clear">--- Clears the left float ---</p>
</div>
</body>
</html>
- Output
-
The box floats to the left
The text wraps to the right of the box.
This is example text.
--- Clears the left float ---