aboutsummaryrefslogtreecommitdiff
path: root/files/ar/web/css/align-content
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:15 -0500
commit4b1a9203c547c019fc5398082ae19a3f3d4c3efe (patch)
treed4a40e13ceeb9f85479605110a76e7a4d5f3b56b /files/ar/web/css/align-content
parent33058f2b292b3a581333bdfb21b8f671898c5060 (diff)
downloadtranslated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.gz
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.tar.bz2
translated-content-4b1a9203c547c019fc5398082ae19a3f3d4c3efe.zip
initial commit
Diffstat (limited to 'files/ar/web/css/align-content')
-rw-r--r--files/ar/web/css/align-content/index.html294
1 files changed, 294 insertions, 0 deletions
diff --git a/files/ar/web/css/align-content/index.html b/files/ar/web/css/align-content/index.html
new file mode 100644
index 0000000000..f3c5002b96
--- /dev/null
+++ b/files/ar/web/css/align-content/index.html
@@ -0,0 +1,294 @@
+---
+title: align-content
+slug: Web/CSS/align-content
+translation_of: Web/CSS/align-content
+---
+<p dir="rtl">تحدد خاصية <strong><code>align-content</code></strong> CSS توزيع المساحة بين و حول محتوى العناصر على طول المحور العرضي لـ flexbox أو محور كتلة <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout">الشبكة</a>.</p>
+
+<p>The interactive example below use Grid Layout to demonstrate some of the values of this property.</p>
+
+<div>{{EmbedInteractiveExample("pages/css/align-content.html")}}</div>
+
+
+
+<p>This property has no effect on single line flex containers (i.e. ones with <code>flex-wrap: nowrap</code>).</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="brush:css no-line-numbers notranslate">/* Basic positional alignment */
+/* align-content does not take left and right values */
+align-content: center; /* Pack items around the center */
+align-content: start; /* Pack items from the start */
+align-content: end; /* Pack items from the end */
+align-content: flex-start; /* Pack flex items from the start */
+align-content: flex-end; /* Pack flex items from the end */
+
+/* Normal alignment */
+align-content: normal;
+
+/* Baseline alignment */
+align-content: baseline;
+align-content: first baseline;
+align-content: last baseline;
+
+/* Distributed alignment */
+align-content: space-between; /* Distribute items evenly
+ The first item is flush with the start,
+ the last is flush with the end */
+align-content: space-around; /* Distribute items evenly
+ Items have a half-size space
+ on either end */
+align-content: space-evenly; /* Distribute items evenly
+ Items have equal space around them */
+align-content: stretch; /* Distribute items evenly
+ Stretch 'auto'-sized items to fit
+ the container */
+
+/* Overflow alignment */
+align-content: safe center;
+align-content: unsafe center;
+
+/* Global values */
+align-content: inherit;
+align-content: initial;
+align-content: unset;
+</pre>
+
+<h3 id="Values">Values</h3>
+
+<dl>
+ <dt><code>start</code></dt>
+ <dd>The items are packed flush to each other against the start edge of the alignment container in the cross axis.</dd>
+ <dt><code>end</code></dt>
+ <dd>The items are packed flush to each other against the end edge of the alignment container in the cross axis.</dd>
+ <dt><code>flex-start</code></dt>
+ <dd>The items are packed flush to each other against the edge of the alignment container depending on the flex container's cross-start side.<br>
+ This only applies to flex layout items. For items that are not children of a flex container, this value is treated like <code>start</code>.</dd>
+ <dt><code>flex-end</code></dt>
+ <dd>The items are packed flush to each other against the edge of the alignment container depending on the flex container's cross-end side.<br>
+ This only applies to flex layout items. For items that are not children of a flex container, this value is treated like <code>end</code>.</dd>
+ <dt><code>center</code></dt>
+ <dd>The items are packed flush to each other in the center of the alignment container along the cross axis.</dd>
+ <dt><code>normal</code></dt>
+ <dd>The items are packed in their default position as if no <code>align-content</code> value was set.</dd>
+ <dt><code>baseline<br>
+ first baseline</code><br>
+ <code>last baseline</code></dt>
+ <dd><img alt='the baseline is the line upon which most letters "sit" and below which descenders extend.' src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/Typography_Line_Terms.svg/410px-Typography_Line_Terms.svg.png" style="height: 110px; width: 410px;"></dd>
+ <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>space-between</code></dt>
+ <dd>The items are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items is the same. The first item is flush with the start edge of the alignment container in the cross axis, and the last item is flush with the end edge of the alignment container in the cross axis.</dd>
+ <dt><code>space-around</code></dt>
+ <dd>The items are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items is the same. The empty space before the first and after the last item equals half of the space between each pair of adjacent items.</dd>
+ <dt><code>space-evenly</code></dt>
+ <dd>The items are evenly distributed within the alignment container along the cross axis. The spacing between each pair of adjacent items, the start edge and the first item, and the end edge and the last item, are all exactly the same.</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, any <code>auto</code>-sized items have their size 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 exactly fills the alignment container along the cross axis.</dd>
+ <dt><code>safe</code></dt>
+ <dd>Used alongside an alignment keyword. If the chosen keyword means that the item overflows the alignment container causing data loss, the item is instead aligned as if the alignment mode were <code>start</code>.</dd>
+ <dt><code>unsafe</code></dt>
+ <dd>Used alongside an alignment keyword. Regardless of the relative sizes of the item and alignment container and whether overflow which causes data loss might happen, the given alignment value is honored.</dd>
+</dl>
+
+<h2 id="Formal_definition">Formal definition</h2>
+
+<p>{{CSSInfo}}</p>
+
+<h2 id="Formal_syntax">Formal syntax</h2>
+
+<pre class="syntaxbox notranslate">{{csssyntax}}</pre>
+
+<h2 id="Examples">Examples</h2>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css; highlight[4] notranslate">#container {
+ height:200px;
+ width: 240px;
+ align-content: center; /* Can be changed in the live sample */
+ background-color: #8c8c8c;
+}
+
+.flex {
+ display: flex;
+ flex-wrap: wrap;
+}
+
+.grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, 50px);
+}
+
+div &gt; div {
+ box-sizing: border-box;
+ border: 2px solid #8c8c8c;
+ width: 50px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+#item1 {
+ background-color: #8cffa0;
+ min-height: 30px;
+}
+
+#item2 {
+ background-color: #a0c8ff;
+ min-height: 50px;
+}
+
+#item3 {
+ background-color: #ffa08c;
+ min-height: 40px;
+}
+
+#item4 {
+ background-color: #ffff8c;
+ min-height: 60px;
+}
+
+#item5 {
+ background-color: #ff8cff;
+ min-height: 70px;
+}
+
+#item6 {
+ background-color: #8cffff;
+ min-height: 50px;
+ font-size: 30px;
+}
+
+select {
+ font-size: 16px;
+}
+
+.row {
+ margin-top: 10px;
+}
+</pre>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html notranslate">&lt;div id="container" class="flex"&gt;
+ &lt;div id="item1"&gt;1&lt;/div&gt;
+ &lt;div id="item2"&gt;2&lt;/div&gt;
+ &lt;div id="item3"&gt;3&lt;/div&gt;
+ &lt;div id="item4"&gt;4&lt;/div&gt;
+ &lt;div id="item5"&gt;5&lt;/div&gt;
+ &lt;div id="item6"&gt;6&lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div class="row"&gt;
+ &lt;label for="display"&gt;display: &lt;/label&gt;
+ &lt;select id="display"&gt;
+ &lt;option value="flex"&gt;flex&lt;/option&gt;
+ &lt;option value="grid"&gt;grid&lt;/option&gt;
+ &lt;/select&gt;
+&lt;/div&gt;
+
+&lt;div class="row"&gt;
+ &lt;label for="values"&gt;align-content: &lt;/label&gt;
+ &lt;select id="values"&gt;
+ &lt;option value="normal"&gt;normal&lt;/option&gt;
+ &lt;option value="stretch"&gt;stretch&lt;/option&gt;
+ &lt;option value="flex-start"&gt;flex-start&lt;/option&gt;
+ &lt;option value="flex-end"&gt;flex-end&lt;/option&gt;
+ &lt;option value="center" selected&gt;center&lt;/option&gt;
+ &lt;option value="space-between"&gt;space-between&lt;/option&gt;
+ &lt;option value="space-around"&gt;space-around&lt;/option&gt;
+ &lt;option value="space-evenly"&gt;space-evenly&lt;/option&gt;
+
+ &lt;option value="start"&gt;start&lt;/option&gt;
+ &lt;option value="end"&gt;end&lt;/option&gt;
+ &lt;option value="left"&gt;left&lt;/option&gt;
+ &lt;option value="right"&gt;right&lt;/option&gt;
+
+ &lt;option value="baseline"&gt;baseline&lt;/option&gt;
+ &lt;option value="first baseline"&gt;first baseline&lt;/option&gt;
+ &lt;option value="last baseline"&gt;last baseline&lt;/option&gt;
+
+ &lt;option value="safe center"&gt;safe center&lt;/option&gt;
+ &lt;option value="unsafe center"&gt;unsafe center&lt;/option&gt;
+ &lt;option value="safe right"&gt;safe right&lt;/option&gt;
+ &lt;option value="unsafe right"&gt;unsafe right&lt;/option&gt;
+ &lt;option value="safe end"&gt;safe end&lt;/option&gt;
+ &lt;option value="unsafe end"&gt;unsafe end&lt;/option&gt;
+ &lt;option value="safe flex-end"&gt;safe flex-end&lt;/option&gt;
+ &lt;option value="unsafe flex-end"&gt;unsafe flex-end&lt;/option&gt;
+ &lt;/select&gt;
+&lt;/div&gt;
+</pre>
+
+<div class="hidden">
+<h3 id="JavaScript">JavaScript</h3>
+
+<pre class="brush: js notranslate">var values = document.getElementById('values');
+var display = document.getElementById('display');
+var container = document.getElementById('container');
+
+values.addEventListener('change', function (evt) {
+ container.style.alignContent = evt.target.value;
+});
+
+display.addEventListener('change', function (evt) {
+ container.className = evt.target.value;
+});
+</pre>
+</div>
+
+<h3 id="Result">Result</h3>
+
+<p>{{EmbedLiveSample("Examples", 260, 290)}}</p>
+
+<h2 id="Specifications">Specifications</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", "#propdef-align-content", "align-content")}}</td>
+ <td>{{Spec2("CSS3 Box Alignment")}}</td>
+ <td>Adds the [ first | last ]? baseline, start, end, left, right, unsafe | safe values.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName("CSS3 Flexbox", "#align-content-property", "align-content")}}</td>
+ <td>{{Spec2("CSS3 Flexbox")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<div>{{cssinfo}}</div>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<h3 id="Support_in_Flex_layout">Support in Flex layout</h3>
+
+<p>{{Compat("css.properties.align-content.flex_context")}}</p>
+
+<h3 id="Support_in_Grid_layout">Support in Grid layout</h3>
+
+<p>{{Compat("css.properties.align-content.grid_context")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <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>
+</ul>
+
+<div>{{CSSRef}}</div>