npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

flex-box-grid

v1.0.0

Published

Responsive, mobile first Flexbox Grid

Downloads

565

Readme

▥ Flex Box Grid

npm Build Status David npm npm

Responsive, mobile first Flexbox Grid

Installation

via npm

npm install flex-box-grid

and use CSS or Sass version from node_modules/flex-box-grid folder

Manual

with CSS

Download css and include inside <head> section.

with Sass

Download flexboxgrid.zip. Extract it to Sass working directory

Demo & Documentation

Demo and most detailed documentation you can find here "Flex Box Grid Demo & Documentation").

Basic

Flex Box Grid systems are used for creating page layouts through a series of rows and columns that house your content. By default Flex Box Grid have 12 columns.

  • Rows must be placed within a .container with predefined paddings that equal half column gutter.
  • Use rows .row to create horizontal groups of columns.
  • Content should be placed within columns with classes .X-n, .S-n, .M-n, .L-n, .XL-n where n is columns number from 1 to 12 (by default).
  • Columns create gutters (gaps between column content) via padding. That padding is offset in rows for the first and last column via negative margin on .row, by default it's 10px.

<div class="container">
    <div class="row">
        <div class="M1">...</div> * 12
        <div class="M8">...</div><div class="M4">...</div>
        <div class="M6">...</div><div class="M6">...</div>
        <div class="M4">...</div> * 3
    </div>
</div>

Media Queries

Media queries is a basis of any Responsive Grid System. To change column behavior each media query breakpoint connected with column class name with simply recognizing size name: X, S, M, L, XL.

As example column with .M6 class will be halfwidth until the window width becomes equal to 768px or less matching $screen--M.

Predefined break points:

$break--S:  480px;
$break--M:  768px;
$break--L:  1024px;
$break--XL: 1440px;

To change column content behavior...

<div class="container">
    <div class="row">
        <div class="M6">
            <div class="foo">...</div>
        </div>
    </div>
</div>

...use appropriate media query

@media (min-width: $screen--M) {
    .foo {
        ...
    }
}

Mixing columns

Wanna different behavior on multiple devices? Try to mix columns.

<div class="container">
    <div class="row">
        <div class="M4 L8">...</div>
        <div class="M8 L4">...</div>
    </div>
    <div class="row">
        <div class="M6 L4">...</div>
        <div class="M6 L4">...</div>
        <div class="M12 L4">...</div>
    </div>
</div>

You can mix any number of different grid classes

Nesting columns

Grid columns can be nested one into another.

<div class="container">
    <div class="row">
        <div class="M8">
            <div class="row">
                <div class="M6">...</div>
                <div class="M6">...</div>
            </div>
        </div>
        <div class="M4">
            <div class="row">
                <div class="M4">...</div>
                <div class="M4">...</div>
                <div class="M4">...</div>
            </div>
        </div>
    </div>
</div>

Offseting columns

Move columns right using --offsetN suffix on grid classes. These will increase left indent of a column. As example .M--offset2 moves .M6 block over 2 columns.

<div class="container">
    <div class="row">
        <div class="M6 M--offset1">...</div>
        <div class="M5">...</div>
    </div>
    <div class="row">
        <div class="M6 M--offset2">...</div>
    </div>
    <div class="row">
        <div class="M4">...</div>
        <div class="M4 M--offset4">...</div>
    </div>
</div>

Reordering columns

Grid columns order can be changed in any way with --orderN suffix. You can change swap blocks position on different devices. No need to duplicate blocks anymore.

<div class="container">
    <div class="row">
        <div class="M3 X--order4">...</div>
        <div class="M3 X--order1">...</div>
        <div class="M3 X--order2">...</div>
        <div class="M3 X--order3">...</div>
    </div>
    <div class="row">
        <div class="M6 M--order6">...</div>
        <div class="M3 M--order6">...</div>
    </div>
</div>

Reversing columns

Well, hard to say what for, but columns can be also reversed with N--reverse

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

Aligning columns

Horizontal

There is predefined classes for horizontal alignment with --start, --center, --end.

<div class="container">
    <div class="row X--start">
        <div class="X3">...</div>
        <div class="X3">...</div>
    </div>
    <div class="row X--center">
        <div class="X3">...</div>
        <div class="X3">...</div>
    </div>
    <div class="row X--end">
        <div class="X3">...</div>
        <div class="X3">...</div>
    </div>
</div>

Vertical

There is also predefined classes for vertical alignment with --top, --middle, --bottom. Also you can do full height stretch with N--stretch.

<div class="container">
    <div class="row X--top">
        <div class="X3">...</div>
        <div class="X3">...</div>
    </div>
    <div class="row X--middle">
        <div class="X3">...</div>
        <div class="X3">...</div>
    </div>
    <div class="row X--bottom">
        <div class="X3">...</div>
        <div class="X3">...</div>
    </div>
    <div class="row X--stretch">
        <div class="X6">...</div>
        <div class="X6">...</div>
    </div>
</div>

Distribution column space

Between

Another helpful feature can be distribution columns space between or around columns.

<div class="container">
    <div class="row X--between">
        <div class="X2">...</div>
        <div class="X2">...</div>
        <div class="X2">...</div>
        <div class="X2">...</div>
    </div>
</div>

Around

<div class="container">
    <div class="row X--around">
        <div class="X2">...</div>
        <div class="X2">...</div>
        <div class="X2">...</div>
        <div class="X2">...</div>
    </div>
</div>

Browsers support

| IE / Edge | Firefox | Chrome | Safari | Opera | iOS Safari | Opera Mini | Chrome for Android | | --------- | --------- | --------- | --------- | --------- | --------- | --------- | --------- | | IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions

FAQ

What is Grid?

The vast majority of websites out there use a grid. They may not explicitly have a grid system in place, but if they have a "main content area" floated to the left a "sidebar" floated to the right, it's a simple grid.

Why use Grid at all?

Using grid system can significant speed up your work, keep you code understandable, solid and DRY.

Why use Flexbox Grid System (FGS) instead float one?

Simply. It's more flexible :) FGS provides you not only the same functionality as float one, it allows significant expand Grid functionality with sorting, reordering, aligning and distribution features.

Concerns?

If you can't say, "Screw IE9" you probably not ready for Flexboxes model in general yet. Also at the moment FGS should contain vendor prefixes -ms- for IE10 and -webkit- for Safari, which increase little bit styles size.

Why use Flex Box Grid? What alternatives are exist?

I tried to use Foundation Grid by Zurb, Flexbox Grid by Kristofer Joseph, Solved by Flexbox by Philip Walton and others. All of them not bad, but in my opinion too complicated for first meet, have specific namespaces and have not full features that Flexboxes model provides.

Flex Box Grid uses simple object oriented name spacing, provides ease customization via Sass variables and have full list of Flexbox features.