I am trying to find a way to select #inner3
…
<div id="outer">
<div id="inner1"> </div>
<div id="inner2"> </div>
<div id="inner3"> of interest </div>
<div id="inner4"> </div>
</div>
… by counting from last (#inner4
) because sometimes #2
isn't present …
<div id="outer">
<div id="inner1"> </div>
<div id="inner2"> of interest </div>
<div id="inner3"> </div>
</div>
and there are only 3 items (and so #inner3
becomes #inner2
).
Note, #id
are for clarity's sake, and not really present in my work.
I'm right now using body > .. > div:nth-child(3)
but counting from top is a problem for me as explained above.
Any solution to this?