Our grid system is implemented as a fork of Material Design's CSS grid. There are two concepts in the grid system, the page container
and the grid elements
.
Page Container Element
This element will typically be used to wrap the entirety of your content. It will define the maximum width of your page as well as it's margins against the edge of the viewport.
For example your body element structure may look something like:
<body> <nav> <ul class="ray-page-container"> <li>Home</li> <li>About</li> <li>Contact</li> </ul> </nav> <main class="ray-page-container"> <h1>Global Access</h1> <p>...</p> <div class="ray-grid"> <div class="ray-grid__cell"> An image or something </div> <div class="ray-grid__cell"> An image or something </div> </div> </main> </body>
Grid Elements
Live Example
Try resizing your browser!
Debug Overlay
You can enable a visual grid overlay by adding a ray-page-container--debug
class name to the ray-page-container
div, or any full-width container (ie, html or body). Grid overlay is aware of phone/tablet/desktop breakpoints and will adjust accordingly.
Note: These classes are not available in the compiled css output, but are available in the non-minified version as well as the scss/ray-debug.scss
file.
Better Together
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Breakpoints
Breakpoint | threshold | max. width | # of cols | gutter | margin |
---|
Rules
ray-grid__cell
s must always be a direct child of aray-grid
- Never mix classes, i.e.
ray-page-container
andray-grid
should never be applied to the same element - Never modify the following attributes on any of the grid elements:
display
,padding
,margin
,width
<!-- good --> <div class="ray-grid"> <div class="ray-grid__cell"> some content </div> </div> <!-- bad, mixing classes --> <div class="ray-grid ray-grid__cell"> some content </div> <!-- bad, cell is not a direct child of ray-grid --> <div class="ray-grid"> <div class="my-wrapper"> <div class="ray-grid__cell"> some content </div> </div> </div>
Structure
<!-- This element is typically used once per page --> <div class="ray-page-container"> <div class="ray-grid"> <div class="ray-grid__cell"> I'm a cell, spanning the default 4 columns </div> <div class="ray-grid__cell--span-4"> I'm another cell that is 4 columns </div> <div class="ray-grid__cell--span-1 ray-grid__cell--push-2"> I'm a cell that is pushed 2 columns from the left </div> <div class="ray-grid__cell--span-full"> I'm another cell that will always span full width </div> </div> </div>
Name | Description |
---|---|
.ray-page-container | Typically used once on a page, defines maximum width and padding charactersitics for the page |
.ray-page-container--align-<POSITION> | Optional, align the grid to the left or right side of the containerPOSITION : left, right |
.ray-page-container--justify-<POSITION> | Optional, align the cells of the grid (default: left, does not affect nested gridsPOSITION : left, center, right |
.ray-grid | Mandatory, for wrapping grid cells |
.ray-grid__cell | Mandatory, for the layout grid cell (default width: 4 columns) |
.ray-grid__cell--align-<POSITION> | Optional, align the cell to the top, middle, or center of the containing gridPOSITION : top, middle, bottom |
.ray-grid__cell--span-<NUMBER_OF_COLUMNS>-<TYPE_OF_DEVICE> | Optional, specifies the number of columns the cell spans on a type of deviceNUMBER_OF_COLUMS : 1 through 12TYPE_OF_DEVICE : desktop, tablet, phone |
.ray-grid__cell--push-<NUMBER_OF_COLUMNS>-<TYPE_OF_DEVICE> | Optional, specifies the number of columns the cell is "pushed" on a type of deviceNUMBER_OF_COLUMS : 1 through 12TYPE_OF_DEVICE : desktop, tablet, phone |
.ray-grid__cell--span-full | Optional, specify that the cell should span the full width of the grid |