Wednesday, January 25, 2012

How Elements float


Elements are floated horizontally; this means that an element can only be floated left or right, not up or down. A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element. The elements after the floating element will flow around it. The elements before the floating element will not be affected. If an image is floated to the right, a following text flows around it, to the left:
Example:
Img
{
Float:right;
}
Floating Elements Next to each other
If you place several floating elements after each other, they will float next to each other if there is room. Here we have made an image gallery using the float property.
Example:
.thumbnail
{
float: left;
width: 110px;
height: 90px;
margin: 5px;
}

No comments:

Post a Comment