2
<style>    
::placeholder {
      color: red;
    }
</style>

<input id="date" name="date" placeholder="Please select release date" type="text"/>

this is my css. Is there any way to define this inline ? I mean with style = "" .

TylerH
  • 20,799
  • 66
  • 75
  • 101
Tanja16
  • 21
  • 3
  • Very poor question title, for what you are actually asking here. You should point out that this is about a rather “special case”, because it is about applying styles via pseudo classes/elements. – 04FS Nov 29 '19 at 14:50
  • You can't specify pseudo-selectors inline according to https://stackoverflow.com/questions/14141374/using-css-before-and-after-pseudo-elements-with-inline-css/20288572 – Marcel Kirsche Nov 29 '19 at 14:53

1 Answers1

3

With CSS variables you can do like below but you need at least to define the style that you can change later:

::placeholder {
  color: var(--c, red); /* The default is red */
}
<input id="date" name="date" placeholder="select date" type="text" >
<input id="date" name="date" placeholder="select date" type="text" style="--c:blue" >
Temani Afif
  • 245,468
  • 26
  • 309
  • 415