0

I have a scenario where i want to target parent div which has table inside.

Parent div has dynamic generated class which make it hard for me to target but the table inside div has fixed class name tablepress as show in example below

<div class="elementor-125">
<table class="tablepress">
......
</table>
</div>

<div class="elementor-126">
<table class="tablepress">
......
</table>
</div>
<div class="elementor-127">
<table class="tablepress">
......
</table>
</div>

Is there a ways using CSS only so that i can target parent div of table using class tablepress

I have been looking but didnt find a working example as lot of forum say it is not supported yet and other way round is possible is i know but i want to target parent div based on child class

Learning
  • 19,469
  • 39
  • 180
  • 373
  • This may answer your question: https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector – KyleRifqi Jan 23 '22 at 17:28
  • No, there is no parent selector in CSS. You need to use Javascript/jQuery to achieve that. – Johannes Jan 23 '22 at 17:41
  • I was afriad of it, unfortunately i cant use jQuery/JS. I thought it may have been added as this has been in wish-list of developers for several years now. – Learning Jan 24 '22 at 04:22

0 Answers0