Float in CSS:

To start working with float first of all you have to know “what is floating?”. Floating means an HTML element can be moved left or right.

In CSS Float is always use for images but we can also use it on layouts.

The HTML elements can be float only horizontally means an HTML element can move left or right not up or down. So that means we can pass only two values in float property one is “left” and another is “right”.

So if you assign float to left than it will move the HTML element to the left side and if you assign it to right than it will move the HTML element to the right side.

Note:

Use an image that is available on your computer.

Example:

In following example we will set both float values for Images

 Example:

In following example we apply float for image and writing content will float

 

Leave a Reply

Your email address will not be published. Required fields are marked *