News for hackers. Stuff that matters.
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by rmdashrfstar on Monday December 24, 2018 @12:53AM (#18750633)
And the reason to use this over built-in CSS grids is...
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by jahbrewski on Monday December 24, 2018 @01:09AM (#18750696)
+1 - I recently went looking for a CSS framework (I was still in the “Bootstrap” mindset), and ultimately decided on vanilla CSS grid + flexbox. If anyone is looking for a resource to learn CSS grid, I highly recommend Grid Garden: http://cssgridgarden.com/
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by PavlovsCat on Monday December 24, 2018 @02:03AM (#18750860)
That is awesome. Did you see this in the footer?

https://flexboxfroggy.com/

Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by dfa1234 on Monday December 24, 2018 @05:58AM (#18751571)
I just started this tutorial. Thats is a "why", not a "how"... So maybe I can ask here. Why grid-column start include the value and grid column end exclude it... In fact where there is a ressource for understanding css logic on the internet?
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by kilburn on Monday December 24, 2018 @06:16AM (#18751615)
> Why grid-column start include the value and grid column end exclude it

All CSS grid properties are defined in terms of grid "lines", not cells. If you have a grid of 2x2 cells, there are actually 3 vertical lines and 3 horizontal lines:

    1 2 3
  1 ┌─┬─┐
  2 ├─┼─┤
  3 └─┴─┘
"grid-column-start: x" means "this area starts the x vertical line"

"grid-column-end: y" means "this area ends at the y vertical line"

As you can see, there is no possible ambiguity here on whether you mean "inclusive" or "exclusive" like there would be if you referred to cells (which is why you had this question). That's the reason they chose to go with the "lines" model.

> In fact where there is a ressource for understanding css logic on the internet?

Usually each CSS spec has a rationale and some introduction to the "why" and the "thinking model" of the spec. For CSS grid you may look at [1].

[1] https://www.w3.org/TR/css-grid-1/#grid-concepts

Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by quickthrower2 on Monday December 24, 2018 @06:02AM (#18751579)
And I guess you can polyfill that back to IE etc.
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by e-oj on Monday December 24, 2018 @01:03AM (#18750671)
When the components in a grid have different heights, a single longer or shorter component stretches the whole row or leaves unpleasant whitespace at the bottom.
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by zanny on Monday December 24, 2018 @01:20AM (#18750734)
You can use auto-flow: dense to have the grid backfill gaps. I haven't had much chance to test its limits cross browser yet though but trivial examples have worked for me so far.

It isn't as optimal a layout system as you can get with javascript but generally so long as all elements are at least half the height of other members of a row it doesn't look offensively bad. And there is room for more sophisticated layout algorithms in the future.

And it generally isn't that hard to pad grid items to be multiples of a common height so they can organically fill consistently.

Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by jtmarmon on Monday December 24, 2018 @01:01AM (#18750667)
Looks like it's addressed here: https://codeburst.io/magic-grid-f8e2221e7cef
Re:Show HN: Magic Grid – A simple JavaScript library for dyn... by thinkloop on Monday December 24, 2018 @12:56AM (#18750641)
This should have definitely been addressed in the readme