Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

looping #179

Open
lukeholder opened this issue Oct 14, 2011 · 0 comments
Open

looping #179

lukeholder opened this issue Oct 14, 2011 · 0 comments

Comments

@lukeholder
Copy link

can you do this is less?

sass example:

$starWidth: 44px;
$starOffset: 0 -43px;
$numStars: 5;
$steps: 2;
$total: $numStars * $steps;

@mixin filled($n: 0) {
  width: ($starWidth / $steps) * $n;
}

.stars {
  background: url(/images/sprite.png) repeat-x top left;
  height: 43px;

  &.empty {
    background-position: $starOffset;
    width: $numStars * $starWidth;
  }

  @for $i from 0 through ($total) {
    &.filled_#{$i} { @include filled($i) }
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant