aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/css/align-self/index.html
blob: d7b3ab68dde3b9cbf1345b68ff8f5e49b8b289c2 (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
---
title: align-self
slug: Web/CSS/align-self
tags:
  - CSS
  - flexbox
  - Свойства
translation_of: Web/CSS/align-self
---
<p>{{CSSRef}}</p>

<h2 id="Описание">Описание</h2>

<p>Свойство <a href="/en-US/docs/CSS" title="CSS">CSS</a> <strong><code>align-self</code></strong> выравнивает flex-элементы по текущей flex-линии, переопределяя значение свойства <a href="/en/CSS/align-items" title="en/CSS/flex-align"><code>align-items</code></a>. Если у какого-либо flex-элемента <strong>margin</strong> в поперечной оси выставлен в <code>auto</code>, то <code>align-self</code> игнорируется.</p>

<p>{{cssinfo}}</p>

<p>Данное свойство не применяется к block-level boxes и к ячейкам таблицы</p>

<p>Подробнее и больше информации читайте в <a href="/en/CSS/Using_CSS_flexible_boxes" title="/en/CSS/Using_CSS_flexible_boxes">Using CSS flexible boxes</a>.</p>

<h2 id="Синтаксис">Синтаксис</h2>

<pre class="brush: css no-line-numbers  language-css"><code class="language-css"><span class="comment token">/* Keyword values */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> auto<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> normal<span class="punctuation token">;</span>

<span class="comment token">/* Positional alignment */</span>
<span class="comment token">/* align-self does not take left and right values */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> center<span class="punctuation token">;</span> <span class="comment token">/* Put the item around the center */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> start<span class="punctuation token">;</span> <span class="comment token">/* Put the item at the start */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> end<span class="punctuation token">;</span> <span class="comment token">/* Put the item at the end */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> self-start<span class="punctuation token">;</span> <span class="comment token">/* Align the item flush at the start */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> self-end<span class="punctuation token">;</span> <span class="comment token">/* Align the item flush at the end */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> flex-start<span class="punctuation token">;</span> <span class="comment token">/* Put the flex item at the start */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> flex-end<span class="punctuation token">;</span> <span class="comment token">/* Put the flex item at the end */</span>

<span class="comment token">/* Baseline alignment */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> baseline<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> first baseline<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> last baseline<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> stretch<span class="punctuation token">;</span> <span class="comment token">/* Stretch 'auto'-sized items to fit the container */</span>

<span class="comment token">/* Overflow alignment */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> safe center<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> unsafe center<span class="punctuation token">;</span>

<span class="comment token">/* Global values */</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> inherit<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> initial<span class="punctuation token">;</span>
<span class="property token">align-self</span><span class="punctuation token">:</span> unset<span class="punctuation token">;</span></code></pre>

<h3 id="Значения">Значения</h3>

<dl>
 <dt><code>auto</code></dt>
 <dd>Computes to the parent's {{cssxref("align-items")}} value.</dd>
 <dt><code>normal</code></dt>
 <dd>The effect of this keyword is dependent of the layout mode we are in:
 <ul>
  <li>In absolutely-positioned layouts, the keyword behaves like <code>start</code> on <em>replaced</em> absolutely-positioned boxes, and as <code>stretch</code> on <em>all other</em> absolutely-positioned boxes.</li>
  <li>In static position of absolutely-positioned layouts, the keyword behaves as <code>stretch</code>.</li>
  <li>For flex items, the keyword behaves as <code>stretch</code>.</li>
  <li>For grid items, this keyword leads to a behavior similar to the one of <code>stretch</code>, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like <code>start</code>.</li>
  <li>The property doesn't apply to block-level boxes, and to table cells.</li>
 </ul>
 </dd>
 <dt><code>self-start</code></dt>
 <dd>Aligns the items to be flush with the edge of the alignment container corresponding to the item's start side in the cross axis.</dd>
 <dt><code>self-end</code></dt>
 <dd>Aligns the items to be flush with the edge of the alignment container corresponding to the item's end side in the cross axis.</dd>
 <dt><code>flex-start</code></dt>
 <dd>The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.</dd>
 <dt><code>flex-end</code></dt>
 <dd>The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.</dd>
 <dt><code>center</code></dt>
 <dd>The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.</dd>
 <dt><code>baseline<br>
 first baseline</code><br>
 <code>last baseline</code></dt>
 <dd>Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box’s first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group.<br>
 The fallback alignment for <code>first baseline</code> is <code>start</code>, the one for <code>last baseline</code> is <code>end</code>.</dd>
 <dt><code>stretch</code></dt>
 <dd>If the combined size of the items along the cross axis is less than the size of the alignment container and the item is <code>auto</code>-sized, its size is increased equally (not proportionally), while still respecting the constraints imposed by {{cssxref("max-height")}}/{{cssxref("max-width")}} (or equivalent functionality), so that the combined size of all <code>auto</code>-sized items exactly fills the alignment container along the cross axis.</dd>
 <dt><code>safe</code></dt>
 <dd>If the size of the item overflows the alignment container, the item is instead aligned as if the alignment mode were <code>start</code>.</dd>
 <dt><code>unsafe</code></dt>
 <dd>Regardless of the relative sizes of the item and alignment container, the given alignment value is honored.</dd>
 <dd> </dd>
</dl>

<h3 id="Формальный_синтаксис">Формальный синтаксис</h3>

{{csssyntax}}

<h2 id="Спецификации">Спецификации</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('CSS3 Box Alignment', '#align-self-property', 'align-self') }}</td>
   <td>{{ Spec2('CSS3 Box Alignment') }}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Совместимость_с_браузерами">Совместимость с браузерами</h2>



<h3 id="Support_in_Flex_layout">Support in Flex layout</h3>

<p>{{Compat("css.properties.align-self.flex_context")}}</p>

<h3 id="Support_in_Grid_layout">Support in Grid layout</h3>

<p>{{Compat("css.properties.align-self.grid_context")}}</p>

<div>{{CSSRef}}</div>

<h2 id="Смотрите_также">Смотрите также</h2>

<ul>
 <li><a href="/en-US/docs/CSS/Using_CSS_flexible_boxes" title="/en-US/docs/CSS/Using_CSS_flexible_boxes">Using CSS flexible boxes</a></li>
 <li>CSS Flexbox Guide: <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 Flexbox Guide: <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 Grid Guide: <em><a href="/en-US/docs/Web/CSS/CSS_Grid_Layout/Box_Alignment_in_CSS_Grid_Layout">Box alignment in CSS Grid layouts</a></em></li>
 <li><a href="/en-US/docs/Web/CSS/CSS_Box_Alignment">CSS Box Alignment</a></li>
 <li>The {{cssxref("align-items")}} property</li>
</ul>