CSS Grid-column-gap Property - W3docs
Có thể bạn quan tâm
- Password Generator
- HTML Editor
- HTML Encoder
- Base 64
- Code Diff
- JSON Beautifier
- CSS Beautifier
- Markdown Convertor
- Find the Closest Tailwind CSS Color
- Phrase encrypt / decrypt
- Browser Feature Detection
- Number convertor
- JTW Decoder
- CSS Maker
- CSS Maker text shadow
- CSS Maker Text Rotation
- CSS Maker Out Line
- CSS Maker RGB Shadow
- CSS Maker Transform
- CSS Maker Font Face
- Color Picker
- Colors CMYK
- Colors HWB
- Colors HSL
- Color Hex
- Color mixer
- Color Converter
- Colors RGB
- Color Contrast Analyzer
- Color Gradient
- String Length Calculator
- MD5 Hash Generator
- Sha256 Hash Generator
- String Reverse
- URL Encoder
- URL Decoder
- Base 64 Encoder
- Base 64 Decoder
- Extra Spaces Remover
- String to Lowercase
- String to Uppercase
- Word Count Calculator
- Empty Lines Remover
- HTML Tags Remover
- Binary to Hex
- Hex to Binary
- Rot13 Transform on a String
- String to Binary
- Duplicate Lines Remover
- Dark
- Light
- System
- CSS Basic CSS IntroductionCSS UsageCSS SyntaxCSS id and classCSS TextCSS FontCSS LinksCSS TablesCSS BorderCSS PaddingCSS MarginCSS Color NamesCSS Gradients
- CSS Guides Flexbox GuideCSS3 Properties
- CSS Selectors CSS Selectors*:active::after::before:checked:default:dir():disabled:empty:enabled:first-child::first-letter::first-line:first-of-type:focus:fullscreen:hover:in-range:indeterminate:invalid:lang():last-child:last-of-type:link:not():nth-child():nth-last-child:nth-last-of-type():nth-of-type:only-child:only-of-type:optional:out-of-range::placeholder:read-only:read-write:required:root:scope::selection:target:valid:visited
- CSS Properties align-contentalign-itemsallanimationalign-selfanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-functionappearancebackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-position-xbackground-position-ybackground-repeatbackground-sizebleedblock-overflowborderborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-style
- border-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottombox-decoration-breakbox-shadowbox-sizingbreak-afterbreak-beforebreak-insidecaption-sidecaret-color@charsetclearclipclip-pathcolorcolumnscolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcontentcounter-incrementcounter-resetcursordirectiondisplayempty-cellsfillfilterflexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloatfont@font-facefont-displayfont-familyfont-feature-settings@font-feature-valuesfont-kerning
- font-sizefont-size-adjustfont-language-overridefont-stretchfont-stylefont-variantfont-variant-alternatesfont-variant-capsfont-variant-east-asianfont-variant-ligaturesfont-variant-numericfont-weightgridgrid-areagrid-auto-columnsgrid-auto-flowgrid-auto-rowsgrid-columngrid-column-endgrid-column-gapgrid-column-startgrid-gapgrid-rowgrid-row-endgrid-row-gapgrid-row-startgrid-templategrid-template-areasgrid-template-columnsgrid-template-rowshanging-punctuationheighthyphensimage-rendering@importinitial-letterisolationjustify-contentjustify-items@keyframesleftletter-spacingline-breakline-clampline-heightlist-stylelist-style-imagelist-style-positionlist-style-typemarginmargin-bottommargin-leftmargin-rightmargin-topmax-height
- max-linesmax-width@mediamin-heightmin-widthmix-blend-modeobject-fitobject-positionoffsetoffset-anchoroffset-distanceoffset-pathoffset-positionoffset-rotateopacityorderorphansoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-anchoroverflow-wrapoverflow-xoverflow-ypaddingpadding-bottompadding-leftpadding-rightpadding-toppage-breakpage-break-afterpage-break-beforepage-break-insideperspectiveperspective-originplace-itemspointer-eventspositionquotesresizerightscroll-behaviorscrollbarshape-outsidespeakstrokestroke-dasharraystroke-dashoffsetstroke-linecapstroke-widthtab-sizetable-layout
- text-aligntext-align-lasttext-combine-uprighttext-decorationtext-decoration-colortext-decoration-linetext-decoration-skiptext-decoration-skip-inktext-decoration-styletext-fill-colortext-indenttext-justifytext-orientationtext-overflowtext-renderingtext-shadowtext-stroketext-stroke-colortext-stroke-widthtext-transformtext-underline-positiontoptransformtransform-origintransform-styletransitiontransition-delaytransition-durationtransition-propertytransition-timing-functionunicode-bidiunicode-rangeuser-selectvertical-alignvisibilitywhite-spacewidowswidthwill-changeword-breakword-spacingword-wrapwriting-modez-indexzoom
The grid-column-gap property sets the size of the gap between the columns.
Length can be specified both by pixels and percentages.
The initially defined grid-column-gap property is replaced by the column-gap property. However, the grid-column-gap prefixed property is used for browser support. Negative values are not allowed.| Initial Value | 0 |
| Applies to | Multi-column elements, flex containers, grid containers. |
| Inherited | No. |
| Animatable | Yes. Gap is animatable. |
| Version | CSS Grid Layout Module Level 1 |
| DOM Syntax | object.style.gridColumnGap = "30px"; |
Syntax
grid-column-gap: normal | length;Example of the grid-column-gap property:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> .grid-container { display: grid; grid-template-columns: auto auto auto auto; grid-column-gap: 30px; grid-row-gap: 10px; background-color: #666; padding: 10px; } .grid-container > div { background-color: #ccc; text-align: center; padding: 20px 0; font-size: 30px; } </style> </head> <body> <h2>Grid-column-gap property example</h2> <div class="grid-container"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> <div>10</div> <div>11</div> <div>12</div> </div> </body> </html> Try it Yourself »Result
Example of the grid-column-gap property with the "%" value:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> .grid-container { display: grid; grid-template-columns: auto auto auto auto; grid-column-gap: 20%; grid-row-gap: 10px; background-color: #666; padding: 10px; } .grid-container > div { background-color: #ccc; text-align: center; padding: 20px 0; font-size: 30px; } </style> </head> <body> <h2>Grid-column-gap property example</h2> <div class="grid-container"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> </div> </body> </html> Try it Yourself »Values
| Value | Description | Play it |
|---|---|---|
| none | This is the default value of this property, which is equal to 0. | Play it » |
| length | The gap between columns is specified by px or percentages. Negative values are not allowed. | Play it » |
| initial | Makes the property use its default value. | |
| inherit | Inherits the property from its parents element. |
Browser support
| | | | | |
|---|---|---|---|---|
| ✓ | ✓ | 1.5+ | 3.0+ | 11.1+ |
Practice Your Knowledge
What is the purpose of the 'column-gap' property in CSS grid layout? It sets the size of the gap between the columns. It sets the size of the gap between the rows. It determines the color of the grid lines. Before the introduction of the 'gap' property, 'column-gap' was used to create spacings. It aligns grid items along the column axis.Quiz Time: Test Your Skills!
Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.
- CSS Basics
Related Resources
- CSS grid Property
- CSS grid-row Property
- CSS grid-column Property
- CSS grid-gap Property
- CSS grid-area Property
- CSS grid-template Property
- CSS grid-auto-columns Property
- CSS grid-auto-rows Property
- CSS grid-auto-flow Property
- PHP basics
- HTML Basics
- Javascript Basics
- CSS Basics
- ES6 Basics
- TypeScript Basics
- React Basics
- Angular Basics
- Sass Basics
- Git Basics
- Vue.js Basics
- SQL Basics
- Python Basics
- Java Basics
- NodeJS Basics
Từ khóa » Html Grid Column Gap
-
Column-gap (grid-column-gap) - CSS: Cascading Style Sheets | MDN
-
Gap (grid-gap) - CSS: Cascading Style Sheets - MDN Web Docs
-
CSS Grid-column-gap Property - W3Schools
-
CSS Grid-gap Property - W3Schools
-
Column-gap - CSS-Tricks
-
A Complete Guide To Grid - CSS-Tricks
-
CSS Grid Dynamic Columns Auto-fit - Gap Between Columns
-
Gap - Tailwind CSS
-
Grid-column-gap - CSS - W3cubDocs
-
Grid Gap CSS - Linux Hint
-
CSS | Grid-gap Property - GeeksforGeeks
-
Column-gap - CSS - W3cubDocs
-
CSS Grid-gap Property - Dofactory
-
Aligning The Grid With Space-around And Space-between