JSFiddle - React, Tailwind, and code Playground
by parkji
HTML
<form>
<div>
<label for="field">Test Field</label>
<input type="text" required name="field" id="field">
</div>
<input type="submit" value="Test">
</form>
CSS
body {
padding: 100px;
}
input:user-error {
background: red;
}
label:matches(:hover, :focus) /for/ input,
label:matches(:hover, :focus):not([for]) input {
background: red;
}