In maths you are able to influence order of operations using ( )
is there anything like that in CSS that would enable me to make this selector work
( .wrapper > input:not(:blank) ) .placeholder {
background-color: green;
}
.placeholder {
width: 200px;
height: 50px;
background-color: red;
margin-top: 20px;
}
<div >
<input type="text" required>
</div>
<div ></div>
CodePudding user response:
The short answer is no, there's not. CSS traverses downwards, hence the name, Cascading Style Sheets (also due in part to the fact that CSS renders as its written, and later declaration override early ones higher in a file.) Given the nature of CSS, you cannot traverse upwards in the DOM under any circumstances.