0

If a .page-builder__item--text has a table in it I want it to take on x styles.

From reading the sass-lang docs I've got this but this doesn't seem to work. Have I misunderstood the docs? If so how? Note: I can't change the html

table {
  .page-builder__item--text & {
    background-attachment: red;
  }
}

the html looks like this

<div class="page-builder__item--text">
    <div class="no-leftpad no-rightpad">
        <div class="pb-text">
           <table>
   //====table content here
           </table>
       </div>
   </div>
</div>
DumbDevGirl42069
  • 709
  • 1
  • 10
  • 32
  • Possible duplicate of [Is there a CSS parent selector?](https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector) – ReSedano Dec 05 '18 at 07:43

1 Answers1

0

There's no way to select ancestors in CSS or SCSS. If the table is full width and height you could target the ::after element to add a background.

Otherwise I recommend javascript.

Bowie
  • 78
  • 8
  • background was just an example, I actually want to put overflow-x: scroll on it at screen. Can you send me in the right direction on your javascript recommendation? Or is there a better solution? I can't have all .page-builder__item--text with an overflow-x: scroll, only ones with tables inside them – DumbDevGirl42069 Dec 05 '18 at 01:02