0

Hello I have this html structure

<span class="item-price">
  <del>
    <span class="woocommerce-Price-amount amount">
      <span class="woocommerce-Price-currencySymbol">S/.</span>144 
    </span>
  </del>
  <ins>
    <span class="woocommerce-Price-amount amount">
      <span class="woocommerce-Price-currencySymbol">S/.</span>139 
    </span>
  </ins>
  <span class="cityeduclass">➤ Incluye el envío a Lima</span>
  <span class="product-stock in-stock" tooltip="En Stock"></span>
</span>

I need to apply to but only if .cityeduclass exists | Only CSS

span.item-price {
     background-color: red;
}

Any ideas Thanks?

Edit: I need something like this span.item-price:has(span.cityeduclass)

Club
  • 111
  • 1
  • 8
  • Short answer is no you cant just do that in CSS. with JavaScript No problem you can add and edit styles as much as you want ... – JonoJames Jul 11 '22 at 02:33
  • In the general case the answer is 'no'. However, in this very specific case, where you just want to give a background, there is a workaround using a pseudo element under specific conditions. Would that be of interest? – A Haworth Jul 11 '22 at 05:21
  • The background was an example css. Actually the css is another. Thank you as well. – Club Jul 11 '22 at 06:01

0 Answers0