float right : float « CSS « HTML / CSS






float right

  


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title></title>
  <style type="text/css">
body {
  margin: 0px;
  padding: 0px;
  color: #000;
  background-color: #ccc;
}



.myStyle {
  float: right;
  padding: 10px;
  margin: 5px;
  background-color: #fff;
  border: 1px solid #000;
  width: 15%;
}

  </style>
</head>

<body>
  <div class="myStyle">1</div>
  <div class="myStyle">2</div>
  <div class="myStyle">3</div>
  <div class="myStyle">4</div>
</body>

</html>

   
  








Related examples in the same category

1.'float' Example
2.float left
3.
  • float: left;
  • 4.float: left
    5.float box model
    6.float control default margin padding
    7.float extra box properties
    8.float highlighted dimensions
    9.float highlighted
    10.float inline
    11.float inline becomes block inline
    12.float inline becomes block multiline inline box model
    13.float left and right
    14.float left and right for three columns layout
    15.float left and right with other content
    16.float: left; margin-left: -700px
    17.float: left; width: 100%
    18.p float: left;
    19.When a block level element is floated, its sizing changes from expand-to-fit, to shrink-to-fit, and is no longer subject to margin collapsing.
    20.When an inline element is floated, it becomes a block-level element with shrink-to-fit sizing.
    21.multiple floats
    22.Using floating elements to create columns
    23.columns floating left
    24.float: left; for right column
    25.The float property is used to force content to wrap around another element.