Giter Site home page Giter Site logo

Fluid grid with gutter? about packery HOT 5 CLOSED

metafizzy avatar metafizzy commented on May 28, 2024
Fluid grid with gutter?

from packery.

Comments (5)

desandro avatar desandro commented on May 28, 2024

Good question! See http://codepen.io/desandro/pen/pBlIw

options

{ "gutter": ".gutter-sizer", "itemSelector": ".item", "columnWidth": ".grid-sizer" }

CSS

.gutter-sizer { width: 2%; }
.grid-sizer { width: 18.4%; }
.item { width: 18.4%; }

Setting columnWidth helps. While it's not required, it helps with fluid/percentage-based widths, to resolve rounding errors.

from packery.

netwire88 avatar netwire88 commented on May 28, 2024

Hi @desandro , just to clarify, if I have fluid width, and I'd like 2 columns per row and 2% gutter, I'd use 100% - 2% / 2 = 49% for each column width?

from packery.

desandro avatar desandro commented on May 28, 2024

@netwire88 Yes! See http://codepen.io/desandro/pen/myOwNY

from packery.

notflip avatar notflip commented on May 28, 2024

Any idea how to get this working with 3 columns? I can't seem to get it right with the above formula.
Thank you

from packery.

desandro avatar desandro commented on May 28, 2024

I've got to update the docs. Until then, take a look at the gutter demo for Packery with Isotope: http://codepen.io/desandro/pen/fGrKe

Using Packery, the options would look like:

$('.grid').packery({
  itemSelector: '.grid-item',
  percentPosition: true,
  gutter: '.gutter-sizer'
});

from packery.

Related Issues (20)

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.