columns floating left : float « CSS « HTML / CSS






columns floating left

 

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitionalt//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>Layout Example</title>
<style type='text/css'>
body {
  margin:0px;
  background-color:#ffffff;
  font-family:arial, verdana, sans-serif;}

#header {
  background-color:#cccccc;
  padding:10px;
  height:120px;}

#navigation {
  background-color:#efefef;
  padding:10px;
  height:40px;}

#footer {
  background-color:#cccccc;
  padding:10px;
  height:40px;
  clear:both;
  border-top:20px solid #ffffff;}

.column1of3, .column2of3, .column3of3 {
  float:left;
  width:28%;
    margin-left:2%;
  background-color:#cccccc;
  padding:1%;
  margin-top:20px;
  height:175px;}
</style>

  </head> 
  <body>
    <div id="header">header</div>
    <div id="navigation">navigation</div>
    <div class="column1of3">column 1 of 3</div>
    <div class="column2of3">column 2 of 3</div>
    <div class="column3of3">column 3 of 3</div>
    <div id="footer">footer</div>
  </body>
</html>

   
  








Related examples in the same category

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