Skip to content

Instantly share code, notes, and snippets.

@tdwesten
Created November 6, 2014 07:31
Show Gist options
  • Save tdwesten/7c08dec24b5846c34f8f to your computer and use it in GitHub Desktop.
Save tdwesten/7c08dec24b5846c34f8f to your computer and use it in GitHub Desktop.
Sass mixin for styling input fields placeholders
// 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 input-placeholder {
// /* styles for placeholder here */
// }
// }
//
@mixin input-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