Skip to content

Instantly share code, notes, and snippets.

@aristretto
Forked from antsa/placeholder.scss
Last active December 14, 2015 22:39
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 aristretto/5159714 to your computer and use it in GitHub Desktop.
Save aristretto/5159714 to your computer and use it in GitHub Desktop.
A mixin to style placeholders in HTML5 form elements. Requires Sass 3.2.
$placeholders: '-webkit-input-placeholder',
'-moz-placeholder',
'-ms-input-placeholder';
@mixin placeholder {
@each $placeholder in $placeholders {
@if $placeholder == "-webkit-input-placeholder" {
&::#{$placeholder} {
@content;
}
}
@else if $placeholder == "-moz-placeholder"{
// FF 18-
&:#{$placeholder} {
@content
}
// FF 19+
&::#{$placeholder} {
@content
}
}
@else {
&:#{$placeholder} {
@content;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment