Skip to content

Commit c6a1cbe

Browse files
committed
Update README.md
Add information about how to display the grid (kinda important, no?) and how to customize the number of columns etc.
1 parent fdc7ac0 commit c6a1cbe

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Grid Overlay
22

3-
This is a small JavaScript component for adding a grid overlay to the page.
3+
This is a small JavaScript + CSS component for adding a grid overlay to the page.
44

55
## Installation
66

@@ -14,3 +14,42 @@ Copy the files from the `build/` folder and add them to the `<head>` section:
1414
Or, if you've got your own build system, you can take the files from the `src/`
1515
folder instead and include them any which way you're used to.
1616

17+
## Displaying
18+
19+
The grid can be displayed by adding a debug class to the page's `<html>` (or `<body>`) element.
20+
21+
I use a bookmarklet to quickly toggle this on and off, like this:
22+
23+
```javascript
24+
javascript:(function()%7Bvar%20htmlNode%20=%20document.querySelector(%22html%22);htmlNode.classList.toggle(%22debug%22);%7D)()
25+
```
26+
27+
Here's the unencoded version:
28+
29+
```javascript
30+
javascript:(function(){var htmlNode=document.querySelector("html");htmlNode.classList.toggle("debug");})()
31+
```
32+
33+
## Customization
34+
35+
The overlay is controlled by a group of CSS Custom Properties, that are defined on the :root,
36+
so can be overridden where necessary - these are the defaults:
37+
38+
```css
39+
:root {
40+
--go-columns: 16;
41+
--go-gap-size: 20;
42+
--go-max-width: 1440;
43+
--go-side-padding: 0;
44+
--go-color: #ff8000;
45+
}
46+
```
47+
48+
| Name | Description |
49+
|----------------| -------------------------------|
50+
| `columns` | Number of columns to create |
51+
| `gap-size` | Size of gaps between columns |
52+
| `max-width` | Maximum width of the full grid |
53+
| `side-padding` | Amount of padding on each side (i.e., when the screen is smaller than `max-width`) |
54+
| `color` | Color for the columns |
55+

0 commit comments

Comments
 (0)