diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/css/gap/index.html | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/ru/web/css/gap/index.html')
-rw-r--r-- | files/ru/web/css/gap/index.html | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/files/ru/web/css/gap/index.html b/files/ru/web/css/gap/index.html new file mode 100644 index 0000000000..701ff15856 --- /dev/null +++ b/files/ru/web/css/gap/index.html @@ -0,0 +1,213 @@ +--- +title: gap (grid-gap) +slug: Web/CSS/gap +translation_of: Web/CSS/gap +--- +<p>Свойство <strong><code>gap</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> задаёт отступы ({{glossary("gutters")}}) между столбцами и строками, а не вдоль края контейнера сетки. Является сокращением для свойств <span class="seoSummary">{{CSSxRef("row-gap")}} и {{CSSxRef("column-gap")}}.</span> {{CSSRef}}</p> + +<p><span class="seoSummary">The <strong><code>gap</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> property sets the gaps ({{glossary("gutters")}}) between rows and columns. It is a <a href="/en-US/docs/Web/CSS/Shorthand_properties">shorthand</a> for {{CSSxRef("row-gap")}} and {{CSSxRef("column-gap")}}.</span></p> + +<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div> + +<div>{{EmbedInteractiveExample("pages/css/grid-gap.html")}}</div> + +<div class="note"> +<p><a href="/en-US/docs/Web/CSS/CSS_Grid_Layout">CSS Grid Layout</a> initially defined the <code>grid-gap</code> property. This prefixed property is being replaced by <code>gap</code>. However, in order to support browsers that implemented <code>grid-gap</code> and not <code>gap</code> for grid, you will need to use the prefixed property as in the interactive example above.</p> +</div> + +<h2 id="Syntax">Syntax</h2> + +<pre class="brush: css; no-line-numbers notranslate">/* One <length> value */ +gap: 20px; +gap: 1em; +gap: 3vmin; +gap: 0.5cm; + +/* One <percentage> value */ +gap: 16%; +gap: 100%; + +/* Two <length> values */ +gap: 20px 10px; +gap: 1em 0.5em; +gap: 3vmin 2vmax; +gap: 0.5cm 2mm; + +/* One or two <percentage> values */ +gap: 16% 100%; +gap: 21px 82%; + +/* calc() values */ +gap: calc(10% + 20px); +gap: calc(20px + 10%) calc(10% - 5px); + +/* Global values */ +gap: inherit; +gap: initial; +gap: unset; +</pre> + +<p>This property is specified as a value for <code><'row-gap'></code> followed optionally by a value for <code><'column-gap'></code>. If <code><'column-gap'></code> is omitted, it’s set to the same value as <code><'row-gap'></code>.</p> + +<p><code><'row-gap'></code> and <code><'column-gap'></code> are each specified as a <code><length></code> or a <code><percentage></code>.</p> + +<h3 id="Values">Values</h3> + +<dl> + <dt>{{CSSxRef("<length>")}}</dt> + <dd>Is the width of the gutter separating the grid lines.</dd> + <dt>{{CSSxRef("<percentage>")}}</dt> + <dd>Is the width of the gutter separating the grid lines, relative to the dimension of the element.</dd> +</dl> + +<h3 id="Formal_syntax">Formal syntax</h3> + +<pre class="syntaxbox notranslate">{{CSSSyntax}}</pre> + +<h2 id="Examples">Examples</h2> + +<h3 id="Flex_layout">Flex layout</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html; notranslate"><div id="flexbox"> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> +</div> +</pre> + +<h4 id="CSS">CSS</h4> + +<pre class="brush: css; highlight[5] notranslate">#flexbox { + display: flex; + flex-wrap: wrap; + width: 300px; + gap: 20px 5px; +} + +#flexbox > div { + border: 1px solid green; + background-color: lime; + flex: 1 1 auto; + width: 100px; + height: 50px; + +} +</pre> + +<h4 id="Result">Result</h4> + +<p>{{EmbedLiveSample("Flex_layout", "auto", "120px")}}</p> + +<h3 id="Grid_layout">Grid layout</h3> + +<h4 id="HTML_2">HTML</h4> + +<pre class="brush: html; notranslate"><div id="grid"> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> + <div></div> +</div></pre> + +<h4 id="CSS_2">CSS</h4> + +<div class="hidden"> +<pre class="brush: css notranslate">#grid { + grid-gap: 20px 5px; +} +</pre> +</div> + +<pre class="brush: css; highlight[5] notranslate">#grid { + display: grid; + height: 200px; + grid-template: repeat(3, 1fr) / repeat(3, 1fr); + gap: 20px 5px; +} + +#grid > div { + border: 1px solid green; + background-color: lime; +} +</pre> + +<h4 id="Result_2">Result</h4> + +<p>{{EmbedLiveSample("Grid_layout", "auto", "120px")}}</p> + +<h3 id="Multi-column_layout">Multi-column layout</h3> + +<h4 id="HTML_3">HTML</h4> + +<pre class="brush: html; notranslate"><p class="content-box"> + This is some multi-column text with a 40px column + gap created with the CSS <code>gap</code> property. + Don't you think that's fun and exciting? I sure do! +</p> +</pre> + +<h4 id="CSS_3">CSS</h4> + +<pre class="brush: css; highlight[3] notranslate">.content-box { + column-count: 3; + gap: 40px; +} +</pre> + +<h4 id="Result_3">Result</h4> + +<p>{{EmbedLiveSample("Multi-column_layout", "auto", "120px")}}</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-gap", "gap")}}</td> + <td>{{Spec2("CSS3 Box Alignment")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<p>{{CSSInfo}}</p> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<h3 id="Support_in_Flex_layout">Support in Flex layout</h3> + +<p>{{Compat("css.properties.gap.flex_context")}}</p> + +<h3 id="Support_in_Grid_layout">Support in Grid layout</h3> + +<p>{{Compat("css.properties.gap.grid_context")}}</p> + +<h3 id="Support_in_Multi-column_layout">Support in Multi-column layout</h3> + +<p>{{Compat("css.properties.gap.multicol_context")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>Related CSS properties: {{CSSxRef("row-gap")}}, {{CSSxRef("column-gap")}}</li> + <li>Grid Layout Guide: <em><a href="/en-US/docs/Web/CSS/CSS_Grid_Layout/Basic_Concepts_of_Grid_Layout#Gutters">Basic concepts of grid layout - Gutters</a></em></li> +</ul> |