aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/glossary/cross_axis/index.html
blob: 63d0665cce2a95bfc445753016fadd33209524b4 (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
---
title: 交叉轴
slug: Glossary/Cross_Axis
translation_of: Glossary/Cross_Axis
original_slug: Glossary/交叉轴
---
<p>弹性容器 {{glossary("flexbox")}} 的交叉轴和主轴 {{glossary("main axis")}} 垂直,因此如果弹性方向是 {{cssxref("flex-direction")}} 行 <code>row</code> 或者反向行 <code>row-reverse</code> ,那么交叉轴就是从上至下地垂直走向的。</p>

<p><img alt="The cross axis runs down the column" src="https://mdn.mozillademos.org/files/15710/Basics3.png" style="display: block; height: 125px; margin: 0px auto; width: 666px;"></p>

<p>如果你的主轴是列 <code>column</code> 或者反向列 <code>column-reverse</code> ,那么交叉轴就是水平走向的。</p>

<p><img alt="The cross axis runs along the row." src="https://mdn.mozillademos.org/files/15711/Basics4.png" style="display: block; height: 244px; margin: 0px auto; width: 523px;"></p>

<p>要在交叉轴上对齐,是通过弹性容器的 <code>align-items</code> 属性来控制的,或者通过弹性元素的 <code>align-self</code> 属性来单独决定的对齐方式。在多行弹性容器中,交叉轴上有多余控件的话,你还可以用 <code>align-content</code> 来控制行的间距。</p>

<h2 id="学习更多">学习更多</h2>

<h3 id="属性参考">属性参考</h3>

<div class="index">
<ul>
 <li>{{cssxref("align-content")}}</li>
 <li>{{cssxref("align-items")}}</li>
 <li>{{cssxref("align-self")}}</li>
 <li>{{cssxref("flex-wrap")}}</li>
 <li>{{cssxref("flex-direction")}}</li>
 <li>{{cssxref("flex")}}</li>
</ul>
</div>

<h3 id="拓展阅读">拓展阅读</h3>

<ul>
 <li>CSS 弹性容器指南:<em><a href="/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox">Basic Concepts of Flexbox</a></em></li>
 <li>CSS 弹性容器指南:<em><a href="/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Aligning_Items_in_a_Flex_Container">Aligning items in a flex container</a></em></li>
 <li>CSS 弹性容器指南:<em><a href="/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Mastering_Wrapping_of_Flex_Items">Mastering wrapping of flex items</a></em></li>
</ul>

<section class="Quick_links" id="Quick_Links">
<ol>
 <li><a href="/en-US/docs/Glossary">MDN Web Docs Glossary</a>

  <ol>
   <li>{{Glossary("Cross Axis")}}</li>
   <li>{{Glossary("Flex")}}</li>
   <li>{{Glossary("Flex Container")}}</li>
   <li>{{Glossary("Flex Item")}}</li>
   <li>{{Glossary("Grid")}}</li>
  </ol>
 </li>
 <li>相关 CSS 属性
  <ol>
   <li>{{cssxref("align-content")}}</li>
   <li>{{cssxref("align-items")}}</li>
   <li>{{cssxref("align-self")}}</li>
   <li>{{cssxref("flex")}}</li>
   <li>{{cssxref("flex-basis")}}</li>
   <li>{{cssxref("flex-direction")}}</li>
   <li>{{cssxref("flex-flow")}}</li>
   <li>{{cssxref("flex-grow")}}</li>
   <li>{{cssxref("flex-shrink")}}</li>
   <li>{{cssxref("flex-wrap")}}</li>
   <li>{{cssxref("justify-content")}}</li>
   <li>{{cssxref("order")}}</li>
  </ol>
 </li>
</ol>
</section>

<div id="gtx-trans" style="position: absolute; left: 78px; top: 1380px;">
<div class="gtx-trans-icon"></div>
</div>