ホーム HTML CSS XML JAVASCRIPT   PHP SQL MORE...   リファレンス 事例集    

CSS3 box-pack プロパティ

CSS3 Reference 完全な CSS3 リファレンス

Center the child elements of a div box by using the box-align and box-pack properties together:

div
{
width:350px;
height:100px;
border:1px solid black;

/* Firefox */
display:-moz-box;
-moz-box-orient:horizontal;
-moz-box-pack:center;
-moz-box-align:center;

/* Safari and Chrome */
display:-webkit-box;
-webkit-box-orient:horizontal;
-webkit-box-pack:center;
-webkit-box-align:center;

/* W3C */
display:box;
box-orient:horizontal;
box-pack:center;
box-align:center;
}

Try it yourself »

ブラウザ・サポート

Internet Explorer Firefox Opera Google Chrome Safari

box-pack プロパティをサポートしているブラウザはありません。

Firefox supports an alternative, the -moz-box-pack property.

Safari and Chrome support an alternative, the -webkit-box-pack property.


定義と用法

box-pack property specifies where child elements of a box are placed when the box is larger than the size of the children.

This property specifies the horizontal position in horizontal boxes, and the vertical position in vertical boxes.

デフォルト値: start
継承: no
バージョン: CSS3
JavaScript構文: object.style.boxPack="center"


構文

box-pack: start|end|center|justify;

説明
start For normal direction boxes, the left edge of the first child is placed at the left side (all extra space is placed after the last child). For reverse direction boxes, the right edge of the last child is placed at the right side (all extra space is placed before the first child)
end For normal direction boxes, the right edge of the last child is placed at the right side (all extra space is placed before the first child). For reverse direction boxes, the left edge of the first child is placed at the left side (all extra space is placed after the last child)
center Extra space is divided evenly, with half placed before the first child and the other half placed after the last child
justify Extra space is divided evenly between each child (no extra space before the first child or after the last child)


CSS3 Reference 完全な CSS3 リファレンス