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
  • 18,208
  • 50
  • 194
  • 356

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
  • 3,709
  • 5
  • 43
  • 59