Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Floats in CSS - Gap/space left on top when floated to the right?

This is a little difficult to describe, but basically there is undesired space left by a floated div on my page. Here are pictures describing the problem. The black boxes are divs.

Before floating:

alt text

After floating:

alt text

Desired effect:

alt text

And I'm not sure if it makes a difference, but I also have an empty div with "clear: both" placed immediately after the floated div.

How can I achieve this?

like image 401
ground5hark Avatar asked Nov 30 '22 11:11

ground5hark


1 Answers

If possible, put the float: right div before the unfloated div in the HTML.

like image 182
David Kolar Avatar answered Dec 09 '22 19:12

David Kolar