Created
February 3, 2011 13:48
-
-
Save johanbrook/809484 to your computer and use it in GitHub Desktop.
The beauty of Sass: creating loops directly in the stylesheet. In this one I've created a @for loop which is shifting the background sprite for each section. No need for a bunch of background-position declarations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
& > section{ | |
float: left; | |
margin-right: $lineheight; | |
width: $wideColumn; | |
background: transparent url(style/images/frontpage-icons.png) no-repeat left top; | |
padding-top: $column; | |
@for $i from 2 through 4 { | |
&:nth-child(#{$i}){ | |
$i: $i - 1; | |
background-position: -224px*$i top; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment