Created
March 14, 2018 12:33
-
-
Save aaronsummers/a295b141fcb3b7091846b9d0b33f8fff to your computer and use it in GitHub Desktop.
SCSS Simple mixin
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
%title-style { | |
&:after { | |
content: ''; | |
position: absolute; | |
bottom: 0; | |
width: px(58); | |
height: px(4); | |
} | |
position: relative; | |
padding-bottom: 1rem; | |
} | |
@mixin title-border($color) { | |
@extend %title-style; | |
&:after { | |
background: $color; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple example of a mixin,
I have a project with mulitiple title colours, some require a matching border and some don't.
So to add the border to the required title add:
I've seperated the static part of the mixin into an extend property. As this will only be included once in the stylesheet, it'll help with the weight of the css.