i

Learn HTML and CSS in 10 Days

Positioning With Floats

Positioning Content

One of the essential things regarding CSS is that it offers the developer the ability to place the elements and content anywhere on the page, thus, carrying structure to our plans and helping make content increasingly digestible.

There are several kinds of positioning available in CSS, and each comes with its application. In this section, we will be looking at a couple of use cases – making reusable layouts and positioning one-off elements uniquely as well as will also be describing a few ways to go about each.

Positioning with Floats

One of the most popular ways to position the web page elements is by using the 'float' property. This property is versatile and can be utilized in several ways.

The 'float' property offers us the ability to take an element, expel it from the ordinary progression of a page, and then position it to the right or left of its parent element. Every other element on the page will them stream around the floated element.

When multiple elements in the web page use the 'float' property simultaneously, then it helps the developer with the ability to make a layout by floating elements straightforwardly by or inverse one another, as found in different column layouts.

The values accepted by the 'float' property are 'left' and 'right.' These two helps in floating the element to the left and right of their parent elements, respectively.

img {

  float: left;

}