Faisal Deedar
Faisal Deedar

Reputation: 25

How to deal with floated elements?

If there are floated elements in a parent element, they parent element looses its shape or has no height. How to deal with this problem?

Thanks

Upvotes: 1

Views: 107

Answers (3)

user286074
user286074

Reputation: 11

Basically you have to wrap floated elements with a block that has a clearfix hack applied. Read more here: http://www.webtoolkit.info/css-clearfix.html

For IE<7 you would also use zoom:1;

Upvotes: 1

Sarfraz
Sarfraz

Reputation: 382736

The solution to that is using clearfix class.

Upvotes: 3

Pekka
Pekka

Reputation: 449485

On the parent, do a:

 style="overflow: auto"

Upvotes: 1

Related Questions