Skip to content

Instantly share code, notes, and snippets.

@larswittenberg
Last active August 29, 2015 14:01
Show Gist options
  • Save larswittenberg/14511d9029b499e8ee33 to your computer and use it in GitHub Desktop.
Save larswittenberg/14511d9029b499e8ee33 to your computer and use it in GitHub Desktop.
Styling HTML5 Placeholder
/*******************************************************************************
* Placehoder Styling
*******************************************************************************/
@mixin placeholder {
&::-webkit-input-placeholder { @content; }
&:-moz-placeholder { @content; } // Firefox 18-
&::-moz-placeholder { @content; } // Firefox 19+
&:-ms-input-placeholder { @content; }
}
/* Verwendung */
input {
@include placeholder {
color: red;
}
}
/*
Source: http://martinwolf.org/2012/10/24/snippet-styling-html5-placeholder/
Source: http://css-tricks.com/snippets/css/style-placeholder-text/
*/
.my-input::-webkit-input-placeholder {
color: #555;
}
.my-input:-moz-placeholder { /* Firefox 18- */
color: #555;
}
.my-input::-moz-placeholder { /* Firefox 19+*/
color: #555;
}
.my-input:-ms-input-placeholder {
color: #555;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment