天天看點

CSS - dispaly:inline-block

如果不是 塊級( block ) 類型的元素,當設定 width, height, margin 屬性時不起作用。因為 display 為 inline 時,沒有這些屬性。

但是,如果 display 設定為 : inline-block 的元素,即保持了 inline 的自調節位置,又同時具備了 block 的 width, height, margin 屬性。

========================================================================

[url=http://www.w3schools.com/css/css_inline-block.asp][b]CSS Layout - inline-block[/b][/url]

[b]The inline-block Value[/b]

It has been possible for a long time to create a grid of boxes that fills the browser width and wraps nicely (when the browser is resized), by using the [color=brown]float[/color] property.

However, the [color=brown]inline-block[/color] value of the [color=brown]display[/color] property makes this even easier.

[color=brown]inline-block[/color] elements are like [color=brown]inline[/color] elements but they can have a [color=brown]width[/color] and a [color=brown]height[/color].

[img]http://dl2.iteye.com/upload/attachment/0116/9034/e9ed1dcb-52d2-3aa2-a702-8d9802733b5e.png[/img]

-