Raster
Simple Grid System


Minimal and straight-forward CSS grid system utilizing descriptive HTML rather than semantic CSS.

Download ↓ Examples
1 2 3 4 5 6 7 8 3 7-8 2+2 5-8 1-4 6.. 2.. 4.. 1-2 4-5

Simplicity first
<grid columns=8>
  <c></c>
  <c span=3>3</c>
  <c></c>
  <c span=7-8>7-8</c>
  <c span=2+2>2+2</c>
  <c span=5-8>5-8</c>
  <c span=1-4>1-4</c>
  <c span=6..>6..</c>
  <c span=2..>2..</c>
  <c span=4..>4..</c>
  <c span=1-2>1-2</c>
  <c span=4-5>4-5</c>
</grid>

The number of columns a grid has is specified by the columns attribute. For instance, to define a grid with 8 columns, you'd write <grid columns=8>.

Cells span a single column by default. The span attribute is used to customize where a cell starts and how many columns it spans. For example, <c span=2-5> starts in column 2 and ends in column 5. A cell with an empty or missing span attribute starts on the next available column and spans one column.

Raster is pure CSS — no JavaScript involved.

The HTML here is what generates the grid you see at the top of this page.

More examples

Possible span= values


2-5 start in column 2,
end in column 5.
2+3 start in column 2,
span 3 columns.
2.. start in column 2,
span remainder of row.
2 start in next column,
span 2 columns.
row span a full row

Responsive design
<grid columns=6>
  <c span=2   span-s=row>
  <c span=3-6 span-s=row>
  <c span=1-2 span-s=1>
  <c span=3.. span-s=2..>
</grid>

Grids lend themselves really well to device-size responsive design. The span-s attribute defines alternate layout when your design is presented on a small screen. This makes designing for large and small screens really easy.

Acme Things    About    Privacy policy Image Welcome to Acme

Tap the example above—or resize your web browser window—to see the layout change. Showing large screen. Additionally, the span-l attribute can be used to control an alternate layout for really large screens.

This entire website is built with grids and changes layout when the window size passes 600dp.

Additional responsive control with columns-s
<grid columns=6
columns-s=3> <c> <c span=2> <c> <c span=2> </grid>

Similar to span-s, columns-s is available on grid tags for alternate layout on small screens. Often a small-screen layout can be accomplished by simply setting columns-s without the need for any span-s attributes. The columns-l attribute is also available for large screens.

Foo Description of foo Bar Description of bar

Tap the example above—or resize your web browser window—to see the layout change. Showing large screen.

Excellent websites with minimal effort Example gallery

Raster is a complete CSS framework for creating websites.
The Raster system is minimal but holistic:

Customize raster.grid.css

raster.grid.css provides the minimal set of <grid> functionality.
If you're looking for a wholesome framework, use raster.css instead.


This CSS generator is also available as a script: generate-grid.js

Open source

Raster is an open-source project and the source code is available on GitHub →


Explore the example gallery →

@rsms