Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Background Grids? #473

Open
atom2ueki opened this issue May 3, 2015 · 3 comments
Open

Better Background Grids? #473

atom2ueki opened this issue May 3, 2015 · 3 comments
Labels

Comments

@atom2ueki
Copy link

screen shot 2015-05-03 at 11 36 31 am
I found that what ever how you setup Susy, even in youtube/web tutorial, when open debug image, there is always a little gap there in the right-hand side, but when you slowly resize the browser, it will disappeared, and come again like a loop, is it caused by the gutter setting? because the ratio cannot be divided into integer

@mirisuzanne
Copy link
Member

Yes, this is a known browser bug in handling sub-pixel rounding on background-images as noted in the documentation. This is why we are considering an svg alternative in #440.

@signalwerk
Copy link

In chrome it's kind of unpleasant to debug. I used the following code to draw the grid for the whole 100% and then it looks perfect:

$susy: (
  columns: 7,
  gutters: 1/6,
  math: fluid,
  output: float,
);

@mixin grid-column-gradient($values...) {
  background-image: linear-gradient(to right, #{$values});
}


@function gradient-stops($grid-columns) {
  $transparent: rgba(0,0,0,0);
  $color: rgba(0,0,0,0.07);

  $column-offset: 0;

  $values: ($color 0);

  @for $i from 1 through $grid-columns {

    @if $i != $grid-columns  {
      $column-offset: $column-offset + span(1);
      $values: append($values, $color $column-offset, comma);
      $values: append($values, $transparent $column-offset, comma);
      $column-offset: $column-offset + gutter();
      $values: append($values, $transparent $column-offset, comma);
      $values: append($values, $color $column-offset, comma);
    } @else {
      $column-offset: $column-offset + span(1);
      $values: append($values, $color $column-offset, comma);
      $values: append($values, $transparent $column-offset, comma);
    }
  }

  @return $values;
}


.container {
    /* mark */
    @include grid-column-gradient(gradient-stops(7));
}

Based on that code:
_visual-grid.scss

@mirisuzanne
Copy link
Member

@signalwerk That's how we used to do it, but we had exactly the same problem with that technique as our current one (and a lot more code). Chrome must have fixed the one bug, and not the other? Very strange. I'll re-open this for a patch.

@mirisuzanne mirisuzanne reopened this Mar 29, 2016
@mirisuzanne mirisuzanne changed the title Layout problem Better Background Grids? Mar 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants