Coder Social home page Coder Social logo

br1o / chewinggrid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tzi/chewing-grid.css

0.0 2.0 0.0 91 KB

An ideal CSS Grid for card design, made with flexbox & love

Home Page: http://tzi.github.io/ChewingGrid

License: MIT License

Shell 11.15% CSS 88.85%

chewinggrid's Introduction

ChewingGrid

An ideal CSS Grid for card design:

  • Adapt to any layout, there is no media-query
  • Fluid card size, thanks to Flexbox (<3) or the float fallback
  • Minimum & maximum width on card

You can play with it: Live demo!

Index

  1. Quick start

  2. Limit the column number

  3. Set a minimum card width

  4. Set a maximum card width

  5. Prevent last row expansion

  6. [How to Contribute] (#how-to-contribute)

  7. [Author & Community] (#author--community)

  8. Quick start


Install ChewingGrid via bower and add it to bower.json dependencies

bower install chewing-grid --save

Let sart with the minimum markup:

<link rel="stylesheet" type="text/css" href="build/chewing-grid-atomic.css"/>
<div class="chew-row">
    <div class="chew-cell">1</div>
    <div class="chew-cell">2</div>
    <div class="chew-cell">3</div>
    ...
</div>
  1. Limit the column number

Add the chew-row--{n} markup, to set the column limit:

<!-- 4 columns maximum -->
<div class="chew-row chew-row--4">
    <div class="chew-cell">1</div>
    <div class="chew-cell">2</div>
    <div class="chew-cell">3</div>
    ...
</div>

Or add a percent flex-basis and a width on cell:

.chew-cell {
    flex-basis: 25%; /* 4 columns */
    width: 25%; /* float fallback */
}
  1. Set a minimum card width

Override the default minimum width (200px) by adding this CSS rule:

.chew-row {
    min-width: 300px
}
  1. Set a maximum card width

Add the chew-card markup:

<div class="chew-row">
    <div class="chew-cell">
        <div class="chew-card">1</div>
    </div>
    <div class="chew-cell">
        <div class="chew-card">2</div>
    </div>
    <div class="chew-cell">
        <div class="chew-card">3</div>
    </div>
    ...
</div>

Override the default maximum width (300px) by adding this CSS rule:

.chew-card {
    max-width: 400px
}
  1. Prevent last row expansion

Add some chew-cell--ghost markup.

<div class="chew-row chew-row--3">
    <div class="chew-cell">1</div>
    <div class="chew-cell">2</div>
    <div class="chew-cell">3</div>
    ...
    <div class="chew-cell chew-cell--ghost"></div>
    <div class="chew-cell chew-cell--ghost"></div>
</div>

You have to add at least column-max-count - 1 items.

How to Contribute

  1. Star the project!
  2. Report a bug that you have found.
  3. Tweet and blog about ChewingGrid and Let me know about it.
  4. Pull requests are also highly appreciated.

Author & Community

ChewingGrid is under MIT License.
It was created & is maintained by Thomas ZILLIOX.

chewinggrid's People

Contributors

tzi avatar

Watchers

br1o avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.