The clear property cancels the floating effects, and stop the wrapping.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
<head>
<title>clear</title>
<style rel='stylesheet' type='text/css'>
img#left {
float: left;
}
img#right {
float: right;
}
p {
clear: both;
margin: 20px 0 0 0;
font: 12px sans-serif;
border: 1px solid rgb(200, 200, 200);
background: rgb(244, 244, 244);
padding: 5px;
}
</style>
</head>
<body>
<img src='http://www.java2s.com/style/logo.png' alt='' id='left' />
<img src='http://www.java2s.com/style/logo.png' alt='' id='right' />
</p>
</body>
</html>
Related examples in the same category