I need to add a top-margin to an element that's inside a list, but only when it has text content above it.
For example, the html I'm working with looks a bit like this:
<li>
Some text
<table> ... </table>
</li>
<li>
<table> ... </table>
</li>
In the first list element, I would want to select the table, and leave the second list element's table untouched. Usually, I'd use something like li > table:not(:first-child)
, but that just selects both tables as that "Some Text" isn't actually an element.
I don't have control of the html in this situation-- so changing that is out. How can I select only the table that's below text? Am I on a wild goose chase for this functionality?