--- title: row-gap (grid-row-gap) slug: Web/CSS/row-gap tags: - CSS - CSS Flexible Boxes - CSS Grid - CSS Property - Reference - recipe:css-property - row-gap translation_of: Web/CSS/row-gap ---
row-gap
は CSS のプロパティで、要素のグリッド行の間のすき間 ({{glossary("gutters", "溝")}}) の寸法を定義します。
/* <length> 値 */ row-gap: 20px; row-gap: 1em; row-gap: 3vmin; row-gap: 0.5cm; /* <percentage> 値 */ row-gap: 10%; /* Global values */ row-gap: inherit; row-gap: initial; row-gap: unset;
<length-percentage>
{{cssinfo}}
<div id="flexbox"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div>
#flexbox { display: flex; flex-wrap: wrap; width: 300px; row-gap: 20px; } #flexbox > div { border: 1px solid green; background-color: lime; flex: 1 1 auto; width: 100px; height: 50px; }
{{EmbedLiveSample('Flex_layout', "auto", "120px")}}
<div id="grid"> <div></div> <div></div> <div></div> </div>
#grid { display: grid; height: 200px; grid-template-columns: 200px; grid-template-rows: repeat(3, 1fr); row-gap: 20px; } #grid > div { border: 1px solid green; background-color: lime; }
{{EmbedLiveSample('Grid_layout', 'auto', 120)}}
仕様書 | 状態 | 備考 |
---|---|---|
{{SpecName("CSS3 Box Alignment", "#propdef-row-gap", "row-gap")}} | {{Spec2("CSS3 Box Alignment")}} | 初回定義 |
{{Compat("css.properties.row-gap.flex_context")}}
{{Compat("css.properties.row-gap.grid_context")}}