I would like to target the previous sibling with css. The following article suggests it can be done. Article on how to select the previous sibling in css (https://tobiasahlin.com/blog/previous-sibling-css-has/)
However, it just won't work. Even on my code below.
.c-floating-label:has(+ .c-input) {
color:blue;
}
h2:has(+ p) {
color:blue;
}
.box:has(+ .circle) {
background:blue;
}
<label for="fullName" class="c-floating-label">Full name</label>
<input type="text" name="fullName" id="fullName" placeholder="Full name" class="c-input">
<br/>
<h2>I am a heading</h2>
<p>I am a paragraph</p>
<br/>
<div class="box">Box</div>
<div class="circle">Circle</div>
<div class="box">Box</div>