Skip to content

Instantly share code, notes, and snippets.

@ScarletPonytail
Last active June 21, 2019 09:53
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 ScarletPonytail/97f020f17c2799bae219060615d4d449 to your computer and use it in GitHub Desktop.
Save ScarletPonytail/97f020f17c2799bae219060615d4d449 to your computer and use it in GitHub Desktop.
// Quick Example
@mixin underline($width) {
width: #{$width};
}
h2 {
@include underline('50%');
}
// Full Example
// Mixin for the background cover
@mixin bg-cover {
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
// Mixin for the tile repeat
@mixin finance-tile($name, $url) {
.finance-tile-#{$name} {
width: 100%;
height: 300px;
position: relative;
background: url(#{$url}) no-repeat center center;
@include bg-cover;
.icon {
position: absolute;
left: 50%;
top: 50%;
}
}
}
// Calling the mixin for each tile
@include finance-tile('one', 'https://web-12.s3.amazonaws.com/draytons/wp-content/uploads/2019/05/07164440/Finance-13.png');
@include finance-tile('two', 'https://web-12.s3.amazonaws.com/draytons/wp-content/uploads/2019/05/07164440/Finance-13.png');
@include finance-tile('three', 'https://web-12.s3.amazonaws.com/draytons/wp-content/uploads/2019/05/07164440/Finance-13.png');
@include finance-tile('four', 'https://web-12.s3.amazonaws.com/draytons/wp-content/uploads/2019/05/07164440/Finance-13.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment