Created
April 16, 2011 22:56
-
-
Save mirisuzanne/923593 to your computer and use it in GitHub Desktop.
styling placeholder text
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
// Mixins --------------------------------------------------------------- | |
=placeholder-style | |
color: #777 | |
// add your defaults here. | |
// if you need more than one style-group you can either create several mixins, | |
// or just name the style-groups and take a single style-group-name argument. | |
=apply-placeholders | |
&::-webkit-input-placeholder | |
+placeholder-style | |
&:-moz-placeholder | |
+placeholder-style | |
&.placeholder | |
+placeholder-style | |
// Template -------------------------------------------------------------- | |
// you can create as many templates as you need for your site | |
.placeholders | |
+apply-placeholders | |
// Placeholders -------------------------------------------------------------- | |
// call the template with @extend when you can | |
// or, when fighting the cascade you can call the mixin | |
input, textarea | |
@extend .placeholders | |
.something | |
+apply-placeholders |
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
.placeholders::-webkit-input-placeholder, input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { | |
color: #777777; | |
} | |
.placeholders:-moz-placeholder, input:-moz-placeholder, textarea:-moz-placeholder { | |
color: #777777; | |
} | |
.placeholders.placeholder, input.placeholder, textarea.placeholder { | |
color: #777777; | |
} | |
.something::-webkit-input-placeholder { | |
color: #777777; | |
} | |
.something:-moz-placeholder { | |
color: #777777; | |
} | |
.something.placeholder { | |
color: #777777; | |
} |
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
// Multiple Placeholder Styles --------------------------------------------------------------- | |
=placeholder-style($style:false) | |
// main styles used by default | |
@if (not $style) or ($style == 'main') | |
color: #777 | |
// alternative style | |
@if $style == 'alt' | |
color: #444 | |
=apply-placeholders($style:false) | |
&::-webkit-input-placeholder | |
+placeholder-style($style) | |
&:-moz-placeholder | |
+placeholder-style($style) | |
&.placeholder | |
+placeholder-style($style) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment