Skip to content

Instantly share code, notes, and snippets.

@aebsr
Last active December 20, 2015 21:08
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 aebsr/6195111 to your computer and use it in GitHub Desktop.
Save aebsr/6195111 to your computer and use it in GitHub Desktop.
placeholder text mixin
// placeholder mixin
.placeholder (@el:~'[placeholder]') {
@{el}::-webkit-input-placeholder { .styles; }
@{el}:-ms-input-placeholder { .styles; }
@{el}::input-placeholder { .styles; }
@{el}:input-placeholder { .styles; }
@{el}::-moz-placeholder { .styles; }
@{el}:-moz-placeholder { .styles; }
@{el}::placeholder { .styles; }
@{el}:placeholder { .styles; }
}
// nested example #1
#signup {
.styles() {
color: green;
}
.placeholder(~'[type="email"]');
}
// nested example #2
#contact {
.styles() {
color: red;
}
.placeholder(~'[type="name"]');
}
// stand alone example
// risky, as it becomes globally set and can be inherited in other style(instances)
.styles() {
color: purple;
}
.placeholder(~'[type="search"]');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment