Thursday, August 13, 2009

Float

* Floating an element allows text to be wrapped around it.
* If you apply the property float:right; to an image, the image will be positioned on the right of the screen and the text will wrap all around it.
* You can also apply the property float:left; to the image and the same will happen but with the image on the left (NB. there is no float:center; option).
* You can add the float property to many different elements, e.g. if you add it to a header element then the text will wrap round the header.
* To avoid having the text render right up beside the floated element you can set the elements margins.
* margin:10px; gives a 10 pixel margin all the way round, or margin:10px 10px 10px 0px; will place a 10 pixel margin on three sides, but in this case not on the left.

No comments:

Post a Comment