I've got a form with input texts (pseudo-code below):
<form>
<input type="text">
</form>
And after submitting with errors in fields, script adds some ul
lists with errors:
<form>
<input type="text">
<ul class="errorlist">
<li>This field has errors!</li>
</ul>
</form>
I would like to add red border for the input with errors - I've tried this:
input + .errorlist{border: 1px solid red}
And it adds border to the ul elements, not input - I know why (I've read documentation) but I would like to invert this selector - something like this:
.errorlist + input{border: 1px solid red}
So summing up I would like to style element that is right BEFORE the other element (before answering please double-check my stylesheet and my HTML) - is there any way to achieve this with pure css?