Created
December 18, 2012 17:22
-
-
Save laurakalbag/4329953 to your computer and use it in GitHub Desktop.
Example of rules based on design patterns in CSS made into a Sass mixin and applied to HTML elements
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
@mixin shadow-border { | |
border-bottom: 1px solid #a4a4a4; | |
-webkit-box-shadow: 0px 2px 5px 0px rgba(200, 200, 200, 0.6); | |
box-shadow: 0px 2px 5px 0px rgba(200, 200, 200, 0.6); | |
padding-bottom: 20px; | |
margin-bottom: 40px; | |
} | |
article { | |
@include shadow-border; | |
} | |
header { | |
@include shadow-border; | |
} | |
p.intro { | |
@include shadow-border; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right, turns out I was wrong. I was getting confused between mixins and placeholder selectors. SO instead of that mixin you'd have this:
Note the % - wherever this appears in your document (and therefore the cascade) is where the extended styles will appear. The method of extending things is the same though - except you need to reference the placeholder:
That does what I said in the previous comment. Have a read of Chris Eppstein's post about the release of 3.2: http://chriseppstein.github.com/blog/2012/08/23/sass-3-2-is-released/ - the bit about placeholder selectors is the first heading after the intro :)