Created
March 23, 2012 12:00
-
-
Save antsa/2170024 to your computer and use it in GitHub Desktop.
Placeholder mixin for Sass
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
// Placeholder @mixin for Sass | |
// | |
// A mixin to style placeholders in HTML5 form elements. | |
// Includes also a .placeholder class to be used with a polyfill e.g. | |
// https://github.com/mathiasbynens/jquery-placeholder | |
// Requires Sass 3.2. | |
// | |
// Example usage (.scss): | |
// | |
// input { | |
// @include placeholder { | |
// /* styles for placeholder here */ | |
// } | |
// } | |
// | |
@mixin placeholder { | |
&.placeholder { @content } | |
&:-moz-placeholder { @content } | |
&::-webkit-input-placeholder { @content } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Sass 3.4 you can use this snippet to work both nested and unnested rules
Usage:
Output:
From this question https://stackoverflow.com/a/17181946