Skip to content

Instantly share code, notes, and snippets.

@Juni4567
Last active December 11, 2015 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juni4567/bb91e7211b9ad129e673 to your computer and use it in GitHub Desktop.
Save Juni4567/bb91e7211b9ad129e673 to your computer and use it in GitHub Desktop.
This is a small file that uses less css for loop to create multiple icons style
@icons: 'cardboard','chevron-left','chevron-right','expand','image','mail','pencil','qoute-left','mouse-pointer';
.icon {
width:20px;
height:20px;
display: inline-block;
background-repeat: no-repeat;
background-size: contain;
vertical-align: middle;
.for(@icons); .-each(@icon) {
@name: e(@icon);
&-@{name} {
background-image: url("images/icons/icon-@{name}.svg");
}
}
}
@Juni4567
Copy link
Author

If you have multiple icons and you want to make your code DRY then this is the best option I got to save time. Use it anywhere you want! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment