Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between float and align property in CSS

Tags:

css

I am designing a website for my client and do not have much experience in web design and CSS. I also want to design it in standard CSS way.

The question is I am quite confused with CSS align property and float property. I know there is much difference between these two properties but I am still not able to handle it correctly at the time of development.

Can anyone explain to me the exact difference between these two properties?

like image 609
J.K.A. Avatar asked Sep 28 '12 06:09

J.K.A.


People also ask

What is float property in CSS?

The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning).

What is the use of align property in CSS?

The text-align property in CSS is used to specify the horizontal alignment of text in an element ie., it is used to set the alignment of the content horizontally, inside a block element or table-cell box.

What is the difference between float and clear in CSS?

Float:none; tells the elements that you do not wish for it to float. Clear tells other elements whether they should be allowed to float or not, and in the case of none, you're allowing floats on both sides. it's why when you use clear:both; that floating stops.


1 Answers

"text-align" applies to the content of a box, while "float" applies to the box itself.

like image 141
Ganesh Bora Avatar answered Oct 05 '22 23:10

Ganesh Bora