Float in CSS

In CSS a very useful tool is float for inserting images. With float you can push an image left or right, up or down. This is what you need to do place images in certain places when we add them to our style sheet. Also, once an element is floated other elements in your webpage will wrap around it. For example, If an image is floated to the left, a following text flows around it, to the right.

So, to float an image to the left for example you would type:


*This can be adjusted to position your images other ways for example left, center, etc….

If you have content before a floated image the content will not be affected, content after the floating image will flow around it. By using float we can more easily style our webpage and pictures so that they can be arranged in more of a gallery view rather than a bunch of stacked images. I hope this helps!

-Olivia Allegretto

~ by oma12 on September 24, 2012.

%d bloggers like this: