Skip to content

Instantly share code, notes, and snippets.

@PiotrKrzyzek
Created September 13, 2018 02:26
Show Gist options
  • Save PiotrKrzyzek/b33359e85a4813f8829fe473f9bfb3ac to your computer and use it in GitHub Desktop.
Save PiotrKrzyzek/b33359e85a4813f8829fe473f9bfb3ac to your computer and use it in GitHub Desktop.
SCSS (SASS) Input Placeholder Template
@mixin optional-at-root($sel) {
@at-root #{if(not &, $sel, selector-append(&, $sel))} {
@content;
}
}
@mixin placeholder {
@include optional-at-root('::-webkit-input-placeholder') {
@content;
}
@include optional-at-root(':-moz-placeholder') {
@content;
}
@include optional-at-root('::-moz-placeholder') {
@content;
}
@include optional-at-root(':-ms-input-placeholder') {
@content;
}
}
.foobar {
@include placeholder {
color: #AAAAAA;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment