Wednesday, July 1, 2015

How is the float property implemented in css?


The css float property allows an element to be pushed to the left or right which allows other elements to wrap around the floated element. The elements specified before the float element will not be effected. Only the elements specified after the floated elements will float around the element.
For ex.
img { float:right;}
This implies that if an image is floated towards the right then the text that follows its would flow around it on the left. The user can also float multiple elements together. The elements would float if there is space available for them to float. Any float element will cause the other elements following it to float around it, to avoid this the user can make use of the clear property. The clear property is used to specify the sides of an element on which the floating of elements is not allowed.
For ex.
.line {clear:both;}
This would prevent the elements from floating around after the float element.

No comments:

Post a Comment