CSS
网格布局 | Grid Layout

格列隙 | grid-column-gap

grid-column-gap

grid-column-gap指定装饰之间的网列。

/* <length> values */ grid-column-gap: 20px; grid-column-gap: 1em; grid-column-gap: 3vmin; grid-column-gap: 0.5cm; /* <percentage> value */ grid-column-gap: 10%; /* Global values */ grid-column-gap: inherit; grid-column-gap: initial; grid-column-gap: unset;

效果就像受影响的人网格线获取宽度:栅极轨道在两个网格线之间是代表它们的排水沟之间的空间。为了调整轨道尺寸,每个沟槽基本上被视为指定长度的额外轨道。负值无效。

计算值0
应用于grid containers
继承no
百分比refer to corresponding dimension of the content area
使用媒体visual
计算值the percentage as specified or the absolute length
动画类型a length
规范顺序the unique non-ambiguous order defined by the formal grammar

语法

取值

<length-percentage>分隔网格列的沟槽的宽度。

形式语法

<length-percentage>where <length-percentage> = <length> | <percentage>

HTML内容

<div id="grid"> <div></div> <div></div> <div></div> </div>

CSS内容

#grid { display: grid; height: 100px; grid-template-columns: repeat(3, 1fr grid-template-rows: 100px; grid-column-gap: 20px; } #grid > div { background-color: lime; }

规范

SpecificationStatusComment
CSS Grid LayoutThe definition of 'grid-column-gap' in that specification.Candidate RecommendationInitial definition

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerEdgeOperaSafari
Basic support57.0152.0 (52.0)2No support3No support3441No support5

FeatureAndroid WebviewChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support57.0157.0152.0 (52.0)2No support344No support