2

I'm trying to mark required (and empty inputs) like this

input:required {
  border: 1px solid green;
}
input[value=""]:required {
  border: 1px solid red;
}
<input type="text" value="" required>

<input type="text" value="Not empty" required>

It seems to work, but once you set a value to the input, it still marked

Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378

1 Answers1

0

If you dont mind using JavaScript you could use an if-statement to give a class based on whether or not the input contains text. then use you CSS on those classes.

Mister Verleg
  • 4,053
  • 5
  • 43
  • 68