Monday, July 14, 2014

Add style for html5 placeholder using CSS

Placeholder:
The placeholder is used to specifies a short hint for an input field.It is new HTML5 tag.

Let's take a look how to add style for placeholder.

Syntax

<input placeholder="Your Text goes Here"/>

CSS

#input::-webkit-input-placeholder {
            color:#09F;
        }
        #input:-moz-placeholder { /* Firefox 18 and older */
                color:#09F;
        }
        #input::-moz-placeholder {  /* Firefox 19+ */
                color:#09F;
        }
        #input:-ms-input-placeholder {
                color:#09F;
        }

HTML File

<input type="text" id="input" placeholder="Name"/>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

No comments:

Post a Comment