Tuesday, 8 May 2018

html - Is there a way to change the color of an HTML5 textbox watermark?





If I have an HTML5 text box as follows








is there a way using HTML or CSS to change the color of the placeholder/watermark from the default light gray?


Answer



See this answer.




Long story short, you need to use CSS Selectors to apply the rules to each browser, which handles the process differently.





input.mytextbox::-webkit-input-placeholder {
/* WebKit browsers */
color: red;
}


input.mytextbox:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: red;
opacity: 1;
}

input.mytextbox::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: red;
opacity: 1;

}

input.mytextbox:-ms-input-placeholder {
/* Internet Explorer 10+ */
color: red;
}






No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...