cssinputfocusplaceholderonfocus

How to change placeholder color on focus?


How to change the color of placeholder when focus the input field? I use this CSS code to set the default color, but how to change it on focus?

::placeholder { color: blue; }

Solution

  • This works for me:

    input:focus::placeholder {
      color: blue;
    }