My goal is to have a red background appear when an input is invalid upon form submission.
I attempted the following code:
input:invalid {
background-color:red;
}
While this solution worked, it caused the red background to show up as soon as the page loaded, even though the fields were empty.
I also explored another option mentioned here, but unfortunately, it did not make any difference.