I have a situation where a third party software provides an html template that I have no access to but they allow css changes.
Given something similar to below, such that I have the id of the second parent div but not the first parent div, is there a way I can change the background colour of the first parent div to red?
<div>
<div>First div</div>
</div>
<div id='second'>
<div>Second div</div>
</div>
I tried something like below but it didn't work:
<style>
/* Styles for the div immediately before the second div */
#second ~ div {
background-color: red;
}
</style>
<div>
<div>First div</div>
</div>
<div id="second">
<div>Second div</div>
</div>
Is it even possible to achieve this with only CSS?
NOTE: I can only change things based on CSS as I have not access to the HTML so I cannot add an id or use javascript