I almost filed this as a support request since I'm totally new to Sass, Compass and Zen... so maybe I'm just missing something. But I think there's a bug and this tiny adjustment (patch) fixes it for me.

Out of the box the #content region has a huge negative right margin. When I assign a zen-grid-item() value, I also end up with a huge negative margin. The code in _grids.scss, line 118 calculates the right margin like so:

#{$rev}: (1 - $column-position - $column-span) * $unit-width;

So if you have @include zen-grid-item(2,3) you end up with 1-3-2 = -4 * 20% =-80% (assuming a 5 col grid)

This patch simply changes it to
#{$rev}: ($column-count - ($column-position - 1) - $column-span) * $unit-width;

extra () around $column-position - 1 just for readability to highlight that for a column position of 1, the adjustment is zero.

Comments

ergophobe’s picture

Hmm... didn't attach this to the first post b/c I wanted an issue number for the file, but marked it already as needs review, so I don't know if it will get queued for testing. In any case - the whole patch is about 12 characters.... so should be pretty easy to review!

johnalbin’s picture

Status: Needs review » Closed (works as designed)

With a 5-column grid, @include zen-grid-item(2,3) the correct right margin is -80%. It is supposed to be the distance between the right edge and the left inner edge of the container. First column ends at 20%, second at 40%, …, fourth at 80%. The zen-grid-item(2,3) grid item spans the 3rd and 4th columns so the right edge of the grid item is 80% away from the left inner edge of the container.

But I think there's a bug and this tiny adjustment (patch) fixes it for me.

Also, you didn't describe any bug. You just described your fix. The math is correct as is. What was the bug?

ergophobe’s picture

>>you didn't describe any bug

Arrghhh... Stupid. Now it's so long ago I don't remember. Sorry. I was having some layout issue, but I can't remember - it was to fix some layout problem and it did... but what?

My apologies for such a vague report.