Gap - Tailwind CSS
Có thể bạn quan tâm
| Class | Styles |
|---|---|
| gap-<number> | gap: calc(var(--spacing) * <value>); |
| gap-(<custom-property>) | gap: var(<custom-property>); |
| gap-[<value>] | gap: <value>; |
| gap-x-<number> | column-gap: calc(var(--spacing) * <value>); |
| gap-x-(<custom-property>) | column-gap: var(<custom-property>); |
| gap-x-[<value>] | column-gap: <value>; |
| gap-y-<number> | row-gap: calc(var(--spacing) * <value>); |
| gap-y-(<custom-property>) | row-gap: var(<custom-property>); |
| gap-y-[<value>] | row-gap: <value>; |
Examples
Basic example
Use gap-<number> utilities like gap-2 and gap-4 to change the gap between both rows and columns in grid and flexbox layouts:
Changing row and column gaps independently
Use gap-x-<number> or gap-y-<number> utilities like gap-x-8 and gap-y-4 to change the gap between columns and rows independently:
Using a custom value
Use utilities like gap-[<value>],gap-x-[<value>], and gap-y-[<value>] to set the gap based on a completely custom value:
<div class="gap-[10vw] ..."> <!-- ... --></div>For CSS variables, you can also use the gap-(<custom-property>) syntax:
<div class="gap-(--my-gap) ..."> <!-- ... --></div>This is just a shorthand for gap-[var(<custom-property>)] that adds the var() function for you automatically.
Responsive design
Prefix gap,column-gap, and row-gap utilities with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<div class="grid gap-4 md:gap-6 ..."> <!-- ... --></div>Learn more about using variants in the variants documentation.
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
-
Grid-column-gap - CSS - W3cubDocs
-
Grid Gap CSS - Linux Hint
-
CSS | Grid-gap Property - GeeksforGeeks
-
Column-gap - CSS - W3cubDocs
-
CSS Grid-gap Property - Dofactory
-
CSS Grid-column-gap Property - W3docs
-
Aligning The Grid With Space-around And Space-between