Float

Home » Float

Revision for “Float” created on February 13, 2015 @ 09:31:32

TitleContentExcerpt
Float
<strong><span style="font-size: 14pt;">What is it?</span></strong>
With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it. Float is often used with images, but it is also useful when working with layouts.

<iframe width="100%" height="300" src="//jsfiddle.net/mapster86/bsLh3wh9/embedded/html,css,result" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

<span style="font-size: 14pt;"><strong>How Elements Float</strong></span>
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:

<span style="font-size: 14pt;"><strong>Floating Elements Next to Each Other</strong></span>
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:

<strong><span style="font-size: 14pt;">Turning off Float – Using Clear</span></strong>
Elements after the floating element will flow around it. To avoid this, use the clear property.



Old New Date Created Author Actions
February 13, 2015 @ 09:31:32 Mr H
February 13, 2015 @ 09:30:36 [Autosave] Mr H
February 13, 2015 @ 09:19:54 Mr H