float: right and clear right : clear « Layout « HTML / CSS






float: right and clear right

 
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
  <title>Floating Positioning</title>
  <style rel="stylesheet" type="text/css">

body {
  margin: 10px;
  border-style: solid;
  border-width: 1px;
  border-color: #000000;
}

p {
  clear: right;
  background-color: red;
}

div.pullQuote {
  float: right;
  border-style: solid;
  border-width: 1px;
  padding: 5px;
  margin: 5px;
  width: 150px;
}
</style>
</head>

<body>
<h1>Floating</h1>
<div class="pullQuote">quote</div>
<p>This will be at the top of the page.  </p>
</body>
</html>

 








Related examples in the same category

1.Clear left
2.left clear to start a new line
3.clear right
4.clear: both
5.Use clear div as the divider
6.clear right and float right
7.clear left only
8.The clear property cancels the floating effects, and stop the wrapping.