Search code examples
javascriptcssangularwebshop

How to style price color on webshop sale price


How can I change so the sale price is red and normal prices remain black? - I tried with div. css - but it doesn't seem like I can only hit the sale price. See the code below

Product on sale:

<div class="prices">
    <s class="is-block m-productlist-price-before-discount" data-ng-bind-html="discount | currency_format">350,00 DKK</s>
    </p>
    <span class="m-productlist-price h5 is-block" data-ng-bind-html="price">250,00 DKK</span>
</div>

Product that is not on sale:

<div class="prices">
    <span class="m-productlist-price h5 is-block" data-ng-bind-html="price">200,00 DKK</span>
</div>

Solution

  • You can try next element selector using (+).

    Please Note: You have one closing p tag which does not have matching opening tag.

    .prices p, .prices p+span{
      color: red;
    }
    <div class="prices">
      <p>
        <s class="is-block m-productlist-price-before-discount" data-ng-bind-html="discount | currency_format">350,00 DKK</s>
      </p>
      <span class="m-productlist-price h5 is-block" data-ng-bind-html="price">250,00 DKK</span>
    </div>
    
    <div class="prices">
      <span class="m-productlist-price h5 is-block" data-ng-bind-html="price">200,00 DKK</span>
    </div>