Tuesday, November 20, 2012

CSS Float

The css float property enables you to determine where to position an element relative to the other elements on the page. When you use the float property, other elements will simply wrap around the element you applied the float to.
float:left;
float: right;



Try out an example:
<head>
<style type=”text/css”>
#container {
width:500px;
background-color:grey;
}
#box1 {
width:250px;
float:left;
background-color:blue;
}
#box2 {
width:250px;
float:right;
background-color:red;
}
</style>

</head>
<body>
<div id=”container”>
<div id=”box1”>
This is left part.
</div>
<div id=”box2”>
This is right part.
</div>
</div>

No comments:

Post a Comment