Chassis.css v3.0.2

The minimalistic grid & typography framework by Joel Eisner

Changelog

3.0.2

Even more minor fixes and improvements:

  • Proper styling for nested columns!
    • Nested rows now remove left/right padding, keeping your content aligned and visually cohesive
  • All build-system javascript has been upgraded to ES2015 (ES6)
  • The following packages were upgraded: autoprefixer, cssnano, and gulp-postcss

Perks

Expandable

The main goal of chassis.css is to give designers a grid system and typography sizing, without any styling. That's it. This is meant for true customization and expansion.

Lightweight

At just 4.51 KB minified, chassis.css has a lot of room to add your own touch. No bloat or extras; Just the bare necessities.

Modern

Built mobile-first, chassis.css is based on a 1200px responsive grid system and utlizes contemporary standards for typography accross all devices.

Installation

$ npm install chassis-css

Grid

The chassis.css grid system works off of a standard 12-column layout. Just type give a div a class of .col-# where # is a number between 1 and 12, and you're ready to go! The grid will keep its layout until the screen reaches a phone size (<767px), and then it will make all columns full-width.

  • Rows are meant to be contained in a container block.
  • Rows are used to create horizontal groups of columns.
  • When a row contains columns with widths that add up to twelve, start a new row.
.col-12
.col-11
.col-1
.col-10
.col-2
.col-9
.col-3
.col-8
.col-4
.col-7
.col-5
.col-6
.col-6

Code

<div class="container">
    <div class="row">
        <div class="col-12">...</div>
    </div>
    <div class="row">
        <div class="col-11">...</div>
        <div class="col-1">...</div>
    </div>
    <div class="row">
        <div class="col-10">...</div>
        <div class="col-2">...</div>
    </div>
    <div class="row">
        <div class="col-9">...</div>
        <div class="col-3">...</div>
    </div>
    <div class="row">
        <div class="col-8">...</div>
        <div class="col-4">...</div>
    </div>
    <div class="row">
        <div class="col-7">...</div>
        <div class="col-5">...</div>
    </div>
    <div class="row">
        <div class="col-6">...</div>
        <div class="col-6">...</div>
    </div>
</div>

Nesting

Rows can even be nested within columns, allowing for complex and versatile layouts within your project.

  • Nested rows still work off the standard 12-column layout
  • Nesting columns directly within other columns will not adjust padding correctly
col-12
col-6
col-4
col-4
col-4
col-6
col-12

Code

<div class="container">
    <div class="row">
        <div class="col-12">
            <div class="row">
                <div class="col-6">
                    <div class="row">
                        <div class="col-4">...</div>
                        <div class="col-4">...</div>
                        <div class="col-4">...</div>
                    </div>
                </div>
                <div class="col-6">
                    <div class="row">
                        <div class="col-12">...</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Offsets

In addition to the grid system, chassis.css comes with offset classes to align columns however you'd like. To use a column offset, just tack on an .offset-# class onto a column where # is a number between 1 and 11. As with before, the styling of a column offset will stay until it reaches phone size, and then the column will be full width with no offset.

.col-4
.col-4 offset-4
.col-3 offset-3
.col-3 offset-3
.col-6 offset-3
<div class="container">
    <div class="row">
        <div class="col-4">...</div>
        <div class="col-4 offset-4">...</div>
    </div>
    <div class="row">
        <div class="col-3 offset-3">...</div>
        <div class="col-3 offset-3">...</div>
    </div>
    <div class="row">
        <div class="col-6 offset-3">...</div>
    </div>
</div>

Helpers

Hide/Show Helpers

Chassis.css comes with a bunch of helper classes to show or hide elements depending on the size of the screen. Only want to show something on mobile? Tack on a class of .sm-show to it and your set. Want to have something only be hidden on tablet devices? Tack on a class of .md-hide to it. It's that simple! Resize your screen to see the below example in action.

This only appears on mobile!
This only appears on tablet!
This only appears on desktop!
This only appears on huge screens!

Code

<div class="container">
    <div class="row">
        <div class="col-12 xs-show">...</div>
        <div class="col-12 sm-show">...</div>
        <div class="col-12 md-show">...</div>
        <div class="col-12 lg-show">...</div>
    </div>
</div>

Source Reader Only

Chassis.css has a standard .sr-only class that allows you hide code visibly, but still allow for it to be picked up by source readers.

[Check Icon] The icon to the left has a span.sr-only hiding inside of it!

Code

<div class="container">
    <div class="row">
        <div class="col-12">
            <i class="fa fa-check"><span class="sr-only">[Check Icon]</span>...</i>
        </div>
    </div>
</div>

Pull/Push Helpers

Chassis.css includes pull and push classes to help you arrange columns in whatever order you like. These classes will switch the order up until the mobile media-query.

I'm a .col-9, and although I'm loaded before the .col-3 in the dom, I show up after (except on mobile).
I'm a .col-3, and although I'm loaded after the .col-9 in the dom, I show up before (except on mobile).

Code

<div class="container">
    <div class="row">
        <div class="col-9 push-3">...</div>
        <div class="col-3 pull-9">...</div>
    </div>
</div>

Float & Text Helpers

Also included in chassis.css are helper classes to float elements left or right, as well as align text (left, center, right, or justified). Pretty awesome stuff.

I'm a normal column with centered text!
I'm being pulled right!

Code

<div class="container">
    <div class="row">
        <div class="col-6 text-center">...</div>
        <div class="col-3 float-right text-right">...</div>
    </div>
</div>

List Helpers

There are two simple, intuitive list helper classes:

.list-unstyled

  • List Item 1
  • List Item 2
  • List Item 3

.list-inline

  • List Item 1
  • List Item 2
  • List Item 3

Code

<div class="col-6">
    <ul class="list-unstyled">
        <li>List Item 1</li>
        <li>List Item 2</li>
        <li>List Item 3</li>
    </ul>
</div>
<div class="col-6">
    <ul class="list-inline">
        <li>List Item 1</li>
        <li>List Item 2</li>
        <li>List Item 3</li>
    </ul>
</div>

Margin/Padding Helpers

Last but not least, chassis.css includes some useful margin/padding helper classes for you to adjust elements exactly how you like. These helper classes are based on the common 15px spacing used throughout the framework, and work in full and double sizes for both top and bottom.

Margins

  • Margin Top (15px) - .mgn-full-top
  • Margin Top (30px) - .mgn-double-top
  • Margin Bottom (15px) - .mgn-full-btm
  • Margin Bottom (30px) - .mgn-double-btm

Padding

  • Padding Top (15px) - .pad-full-top
  • Padding Top (30px) - .pad-double-top
  • Padding Bottom (15px) - .pad-full-btm
  • Padding Bottom (30px) - .pad-double-btm