aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/css/box-pack/index.html
blob: 22b80afad8cda8855b7021160e39962eee8a505b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
title: box-pack
slug: Web/CSS/box-pack
tags:
  - CSS
  - CSS プロパティ
  - Non-standard
  - Reference
  - box-pack
translation_of: Web/CSS/box-pack
---
<div>{{CSSRef}}{{Non-standard_header}}</div>

<div class="blockIndicator warning">
<p>これはもともと CSS Flexible Box Layout Module の草稿のプロパティでしたが、より新しい標準に置き換えられました。現在の標準についての情報は<a href="/ja/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes">フレックスボックス</a>を参照してください。</p>
</div>

<p><a href="/ja/docs/Web/CSS">CSS</a><strong><code>-moz-box-pack</code></strong> および <strong><code>-webkit-box-pack</code></strong> プロパティは、 <code>-moz-box</code> または <code>-webkit-box</code> がどのようにレイアウトの方向に内容をまとめるかを指定します。この効果はボックス内に余白がある場合のみ見ることができます。</p>

<pre class="brush: css no-line-numbers">/* キーワード値 */
box-pack: start;
box-pack: center;
box-pack: end;
box-pack: justify;

/* グローバル値 */
box-pack: inherit;
box-pack: initial;
box-pack: unset;
</pre>

<p>レイアウトの方向は要素の方向、 horizontal または vertical に依存します。</p>

<div>{{CSSInfo}}</div>

<h2 id="Syntax" name="Syntax">構文</h2>

<p><code>box-pack</code> プロパティは、以下に列挙されたキーワード値のうちの一つで指定します。</p>

<h3 id="Values" name="Values"></h3>

<dl>
 <dt><code>start</code></dt>
 <dd>ボックスは内容を先頭にまとめ、残りの余白を末尾に残します。</dd>
 <dt><code>center</code></dt>
 <dd>ボックスは内容を中央にまとめ、残りの余白を先頭と末尾に均等に分配します。</dd>
 <dt><code>end</code></dt>
 <dd>ボックスは内容を末尾にまとめ、残りの余白を先頭に残します。</dd>
 <dt><code>justify</code></dt>
 <dd>余白はそれぞれの子の間に均等に配分され、最初の子の前と最後の子の後には余白が配置されません。子が一つだけであれば、値が <code>start</code> であるのと同様に扱われます。</dd>
</dl>

<h3 id="Formal_syntax" name="Formal_syntax">形式文法</h3>

{{CSSSyntax}}

<h2 id="Examples" name="Examples"></h2>

<pre class="brush: css">div.example {
  border-style: solid;

  display: -moz-box; /* Mozilla */
  display: -webkit-box; /* WebKit */

  /* このボックスを子よりも高くし、
     box-pack のための余裕を作る */
  height: 300px;
  /* このボックスを、水平方向に中央揃えされた
     内容を表示するのに十分な幅にする */
  width: 300px;

  /* 子を垂直方向に並べる */
  -moz-box-orient: vertical; /* Mozilla */
  -webkit-box-orient: vertical; /* WebKit */

  /* 子をこのボックスの水平方向に中央揃えする */
  -moz-box-align: center; /* Mozilla */
  -webkit-box-align: center; /* WebKit */

  /* 子をこのボックスの下にまとめる */
  -moz-box-pack: end;             /* Mozilla */
  -webkit-box-pack: end;          /* WebKit */
}

div.example p {
  /* 子を親より狭くして、
     box-align のための余裕を作る */
  width: 200px;
}
</pre>

<pre class="brush: html">&lt;div class="example"&gt;
  &lt;p&gt;I will be second from the bottom of div.example, centered horizontally.&lt;/p&gt;
  &lt;p&gt;I will be on the bottom of div.example, centered horizontally.&lt;/p&gt;
&lt;/div&gt;
</pre>

<div>{{EmbedLiveSample('Examples', 310, 310)}}</div>

<h2 id="メモ">メモ</h2>

<p>まとめる目的で <em>start</em> で示されるボックスの端は、ボックスの向きと方向に依存します。</p>

<table class="standard-table" style="text-align: center;">
 <tbody>
  <tr>
   <th> </th>
   <th><strong>Normal</strong></th>
   <th><strong>Reverse</strong></th>
  </tr>
  <tr>
   <th style="text-align: right;"><strong>Horizontal</strong></th>
   <td></td>
   <td></td>
  </tr>
  <tr>
   <th style="text-align: right;"><strong>Vertical</strong></th>
   <td></td>
   <td></td>
  </tr>
 </tbody>
</table>

<p>start と反対の端は <em>end</em> で表されます。</p>

<p>まとめ方が要素の <code>pack</code> 属性を使用して設定されていた場合は、スタイルは無視されます。</p>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<p>このプロパティは標準外ですが、 <a class="external" href="http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/">CSS3 Flexbox の早期の草稿</a>に似たプロパティが現れ、仕様書のより新しい版で置き換えられました。</p>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2>

<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力してくださるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div>

<div>{{Compat("css.properties.box-pack")}}</div>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li>{{CSSxRef("box-orient")}}</li>
 <li>{{CSSxRef("box-direction")}}</li>
 <li>{{CSSxRef("box-align")}}</li>
</ul>