I have an HTML structure with three structures of some element and two p
's right under:
<some_tag></some_tag>
<p></p>
<p></p>
<some_tag></some_tag>
<p></p>
<p></p>
<some_tag></some_tag>
<p></p>
<p></p>
In practice I have much more than just three structures (more like thirty) so I need automation.
I need to select each last p
in the first two structures, but not the last p
in the last structure.
My problem
There seem to be no CSS way to do the selection I desire.
Considering an HTML way of wrapping each non-last, some_tag
structure in some other element (like a div
) I conclude I don't like this solution as it seems to me unaesthetic.
My question
Do you know a way to automate the described selection via JavaScript?
`s in every structure and then, target the very last `
` on the page and remove the styling.
– Titus Aug 21 '18 at 05:33` who has a next sibling and that sibling isn't a `
` (there is nothing **last** about any of the `
` except for the one you **don't** wan't to select
– Jaromanda X Aug 21 '18 at 05:47` that has a next sibling, and that sibling isn't a `
` - isn't that what you want? I don't think you can do this with CSS - because there's no way to refer to next sibling (or children for that matter) in a way that the target element isn't that sibling or child
– Jaromanda X Aug 21 '18 at 05:52