What You Should Know About Floats

来源:互联网 发布:vscode react emmet 编辑:程序博客网 时间:2024/05/22 17:51

原文 http://coding.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/

key points 如下

1. A floated box is positioned within the normal flow, then taken out of the flow and shifted to the left or right as far as possible.

Floated boxes will move to the left or right until their outer edge touches the containing block edge or the outer edge of another float.

2. When you float an element it becomes a block box. This box can then be shifted to the left or right on the current line.

You should always set a width on floated items (except if applied directly to an image – which has implicit width). If no width is set, the results can be unpredictable.

0 0
原创粉丝点击