🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #75

CSS Float


The CSS float Property

The float property specifies how an element should float within its container.

It places an element on the left or right side of its container, allowing text and inline elements to wrap around it.

The float property can have one of the following values:

  • left - The element floats to the left of its container
  • right - The element floats to the right of its container
  • none - Default. The element does not float and is displayed just where it occurs in the text
  • inherit - The element inherits the float value of its parent

Tip: The float property is often used to wrap text around images!


CSS float: right Example

The float: right value indicates that an element should float to the right within its container.

The following example specifies that the image should float to the right.

Tip: If you make the screen smaller, you will see that the text wraps around the image.

Example

img {
  float: right;
}

CSS float: left Example

The float: left value indicates that an element should float to the left within its container.

The following example specifies that the image should float to the left:

Example

img {
  float: left;
}

CSS float: none Example

The float: none value is the default value for float, and the element is displayed just where it occurs in its container.

In the following example the image will be displayed just where it occurs in the container:

Example

img {
  float: none;
}

CSS Float Next To Each Other

HTML

elements are block elements, and will start on a new line and take up the full width available. However, if we use float: left we can make the
elements to float next to each other:

Example

  div {
  float: left;
  padding: 15px;
}

.div1 {

  background: red;
}

.div2 {
  background: yellow;
}

.div3 {
  background: green;
}

CSS Float Property

Property Description
float Specifies whether an element should float to the left, right, or not at all

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

CSS Float – FAQs

Quick answers about learning CSS Float in CSS.

This free note from CodingNow 2.0 explains CSS Float in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including CSS Float, is 100% free with no signup required.
With focused practice, most students grasp CSS Float in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now