Placeholder text color in input field

I have an input field with placeholder text. I want one word to be of a different color, like red, how would I do it? Span styling and the surrounding span word did not work.

For example, on this site I want the number in the phrase “Search 649 radio stories” to be red.

http://66.251.226.207/library

+3
source share
2 answers

What about overlaying a div over an input that disappears when you click on it (and then directs focus to the input)? This way you can style text fragments, but you want to.

$('#myInputOverlayDiv').click(function() {
    $(this).hide();
    $('#myInputElement').focus();
})
+2
source

, , .

WebKit, CSS:

input::-webkit-input-placeholder {
    color: red;
}

, placeholder , . Gecko Mozilla 457801, , .

+10

Source: https://habr.com/ru/post/1733946/


All Articles