CSS Float 原理详解(中英文对照)

  

  本文介绍CSS Float的基本原理和行为特征,并介绍各种浏器Float特性的Bugs。

  if you are like most people, the whole issue of Floats is rather intimidating. The theory is difficult to grasp, and on top of that, the bugs are rumored to be numerous and nasty. Well fear not, because we will walk through the concepts, some of the bugs, and the practical uses of floats, in nice easy stages. Be assured that you will suffer no ill effects. Rather, a vast new world of positioning will open up before you. Onward!

基本的浮动原理

  Any element may be floated. Paragraphs, div’s, lists, tables, and images can all be floated, and in fact even inline elements like “span” and “strong” can float just fine.

  任何元素 element 都可以被浮动。段落、div、list、tables,以及图像都可以被浮动,事实上即使是像 span 和 strong 这样的行内置元素也可以很好地进行浮动。

  Any element that is declared to be a “float” is automatically made a “block level element,” meaning it can have both a declared “width” and “height.” In fact, floats are currently required to have a declared width, but this is not what modern browser makers think, and the W3C has come to agree. The consensus now is that a float with no assigned “width” should “shrink-wrap” to the width of the float content. So a float with an image inside will be as wide as the image, and a float with text will be as wide as the longest text line in the float.

第 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 页

CSS Float 原理详解(中英文对照)

相关文章:

你感兴趣的文章:

标签云: