HTML isn’t written one layer deep. A great grid framework should allow you to embed divs within divs, but still remember how many columns are available. Without subgrids, users of your grid framework are prone to accidently break out of your design spec.
Different experiences have different browser requirements based on the users visiting. Your grid framework should also be performant with the smallest amount of code needed. With this project’s fine-tuned browser compatibility settings, you can support the right browser versions with as little grid code as possible.
We get a lot of flexibility by writing this package in isomorphic JavaScript:
This package lets you configure your grid’s browser compatibility. The trade-off is that with more backwards compatibility, the larger the size of the grid code will be. This configuration option is great for developers that have multiple products with differing browser requirements.
Support Mode | Chrome | Edge | Firefox | IE | Opera | Safari | ||
---|---|---|---|---|---|---|---|---|
displayFlex | 29 | 12 | 20 | 11 | 12.1 | 9 | Available | Details |
cssVariables | 49 | 15 | 31 | NA | 36 | 9.1 | Available | Details |
displayGrid | 57 | 16** | 52 | NA | 44 | 10.1 | Available (Default) | Details |
displaySubgrid * | ? | ? | ? | NA | ? | ? | Work-in-Progress | Details |
display: subgrid
.npm install grid-wiz
import gridWiz from "grid-wiz";var yourGridCSS = gridWiz({prefix: "bx--", // Prefix for all CSS class names. Can be empty.support: "displayGrid", // `displayFlex`, `cssVariables`, or `displayGrid`maxWidth: 1584, // Max-width of entire grid in pixels. Optional.progressive: false, // Include all browser support fallbacks older than selected supportsubgrid: true, // Embedded grids and rows know the remaining amount of columns available.breakpoints: [{name: "sm", // Class name prefix fot the breakpoint.size: 0, // Starting screen width in pixels of the breakpoint.columns: 4, // Amount of columns available.gutter: 32, // Space between content of adjacent columns in pixels.margin: 0 // Space on outside of entire grid in pixels.},{name: "md",size: 672,columns: 8,gutter: 32,margin: 16},{name: "lg",size: 1056,columns: 16,gutter: 32,margin: 16},{name: "xl",size: 1312,columns: 16,gutter: 32,margin: 16},{name: "max",size: 1584,columns: 16,gutter: 32,margin: 32}]});
To work on this project locally, just do npm i
once and then npm run start
to open up dev mode in browser at http://localhost:4000
.