开发者

When Must a Float be Cleared?

I have some question about when floated elements need and don't need to be cleared.

Consider the following markup:

<div>
    <div style="float:right">
        <a href="#">Delete Des开发者_如何学编程tination</a>
    </div>
    Unfloated text here.
</div>

This seems to work correctly, although I never clear the floated content. Does this markup have potential problems?


Clearing the text would move it down underneath your "Delete destination".

Ref: https://developer.mozilla.org/en/CSS/clear


Do you remember school days, when you needed to go to the next line?

Whenever you want to go the next line, you gotta clear the floats. But the difference in CSS and browser world is that, next line may be 500px down :). Whenever you want to continue having elements on the same line, then don't clear the floats.

This is of course very basic explanation. Please let me know if I can help more.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜