-
Notifications
You must be signed in to change notification settings - Fork 155
add grid class documentation #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ec44a7f
add grid doc
trebor b82d1f1
change how example code is rendered
trebor 5615ea6
remove word salid
trebor b602e99
improve advice
trebor ba83f33
fix capitolization
trebor ad49eaa
Update docs/layout/grid.md
trebor 89f62f5
Update docs/layout/grid.md
trebor 3a37cf4
Update docs/layout/grid.md
trebor e26fb76
Update docs/layout/grid.md
trebor 2e374fb
remove overshare
trebor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
--- | ||
toc: false | ||
theme: dashboard | ||
--- | ||
|
||
# Layout:Grid | ||
|
||
The CLI provides a set of grid CSS classes to help layout page content. These grids pair well with the [Dashboard](./themes#dashboard) theme and the [Card](./card) class. This page uses both. | ||
|
||
To see the examples here change dynamically, adjust this pages width and show/hide the navigation on the left. | ||
|
||
As with any CSS provided by the CLI, you can mix in standard CSS to customized your pages. | ||
trebor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Classes | ||
|
||
The following CSS classes are provided for grid layouts: | ||
|
||
Class | Description | ||
---------------- | ------------ | ||
`grid` | specify a grid layout for an element | ||
`grid-cols-2` | restrict grid to two columns | ||
`grid-cols-3` | restrict grid to three columns | ||
`grid-cols-4` | restrict grid to four columns | ||
`grid-colspan-2` | specify that a grid cell spans two columns | ||
`grid-colspan-3` | specify that a grid cell spans three columns | ||
`grid-colspan-4` | specify that a grid cell spans four columns | ||
`grid-rowspan-2` | specify that a grid cell spans two rows | ||
`grid-rowspan-3` | specify that a grid cell spans three rows | ||
`grid-rowspan-4` | specify that a grid cell spans four rows | ||
|
||
|
||
## Example Two Column Grid | ||
trebor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<div class="grid grid-cols-2"> | ||
<div class="card"><h1>A</h1>1 × 1</div> | ||
<div class="card grid-rowspan-2"><h1>B</h1> 1 × 2</div> | ||
<div class="card"><h1>C</h1>1 × 1</div> | ||
<div class="card grid-colspan-2"><h1>D</h1>1 × 2</div> | ||
<div class="card grid-colspan-2 grid-rowspan-2"><h1>E</h1>2 × 2</div> | ||
</div> | ||
|
||
```html run=false | ||
<div class="grid grid-cols-2"> | ||
<div class="card"><h1>A</h1>1 × 1</div> | ||
<div class="card grid-rowspan-2"><h1>B</h1> 1 × 2</div> | ||
<div class="card"><h1>C</h1>1 × 1</div> | ||
<div class="card grid-colspan-2"><h1>D</h1>1 × 2</div> | ||
<div class="card grid-colspan-2 grid-rowspan-2"><h1>E</h1>2 × 2</div> | ||
</div> | ||
``` | ||
|
||
## Example Four Column Grid | ||
trebor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<div class="grid grid-cols-4"> | ||
<div class="card"><h1>A</h1>1 × 1</div> | ||
<div class="card"><h1>B</h1>1 × 1</div> | ||
<div class="card"><h1>C</h1>1 × 1</div> | ||
<div class="card"><h1>D</h1>1 × 1</div> | ||
<div class="card grid-colspan-3 grid-rowspan-2"><h1>E</h1>3 × 2</div> | ||
<div class="card grid-rowspan-2"><h1>F</h1>1 × 2</div> | ||
<div class="card grid-colspan-2"><h1>G</h1>2 × 1</div> | ||
<div class="card grid-colspan-2"><h1>H</h1>2 × 1</div> | ||
</div> | ||
|
||
```html run=false | ||
<div class="grid grid-cols-4"> | ||
<div class="card"><h1>A</h1>1 × 1</div> | ||
<div class="card"><h1>B</h1>1 × 1</div> | ||
<div class="card"><h1>C</h1>1 × 1</div> | ||
<div class="card"><h1>D</h1>1 × 1</div> | ||
<div class="card grid-colspan-3 grid-rowspan-2"><h1>E</h1>3 × 2</div> | ||
<div class="card grid-rowspan-2"><h1>F</h1>1 × 2</div> | ||
<div class="card grid-colspan-2"><h1>G</h1>2 × 1</div> | ||
<div class="card grid-colspan-2"><h1>H</h1>2 × 1</div> | ||
</div> | ||
``` | ||
|
||
## Example Three Column Grid with Customizations | ||
trebor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Note that the minimum row height is set to 150px, and cell **D** does not use the `card` class. | ||
|
||
<div | ||
class="grid grid-cols-3" | ||
style="grid-auto-rows: minmax(150px, auto); color: red;" | ||
> | ||
<div class="card"><h1>A</h1>1 × 1</div> | ||
<div class="card"><h1>B</h1>1 × 1</div> | ||
<div class="card"><h1>C</h1>1 × 1</div> | ||
<div class="grid-rowspan-2"><h1>D</h1>1 × 2</div> | ||
<div class="card grid-colspan-2"><h1>E</h1>2 × 1</div> | ||
<div class="card grid-colspan-2"><h1>F</h1>2 × 1</div> | ||
</div> | ||
|
||
```html run=false | ||
<div | ||
class="grid grid-cols-3" | ||
style="grid-auto-rows: minmax(150px, auto); color: red;" | ||
> | ||
<div class="card"><h1>A</h1>1 × 1</div> | ||
<div class="card"><h1>B</h1>1 × 1</div> | ||
<div class="card"><h1>C</h1>1 × 1</div> | ||
<div class="grid-rowspan-2"><h1>D</h1>1 × 2</div> | ||
<div class="card grid-colspan-2"><h1>E</h1>2 × 1</div> | ||
<div class="card grid-colspan-2"><h1>F</h1>2 × 1</div> | ||
</div> | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.