0

I want to add CSS only for listing-system class but child class of "expired". How i am struggling to write CSS for it, can anyone help me. Thanks

<div class="listing-system">
    <div class="listing-system-row">
        <div class="listing-system-row-image">
            <a href="#" style="background-image: url('#')">
                <div class="ribbon expired">
                    Expired                                 
                </div><!-- /.ribbon -->
            </a>
        </div><!-- /.listing-system-row-image -->
    </div><!-- /.listing-system-row-actions -->
</div><!-- /.listing-system-row -->

<div class="listing-system">
    <div class="listing-system-row">
        <div class="listing-system-row-image">
            <a href="#" style="background-image: url('#')">
                <div class="ribbon">
                    Pending                                 
                </div><!-- /.ribbon -->
            </a>
        </div><!-- /.listing-system-row-image -->
    </div><!-- /.listing-system-row-actions -->
</div><!-- /.listing-system-row --
Nica
  • 177
  • 4
  • 17

2 Answers2

0

You can do this via Jquery, If you want to select a class '.listing-system' which has a child class '.ribbon.expired',

$('.ribbon.expired').closest('.listing-system').css('your css style goes here');
Manju
  • 1,680
  • 2
  • 12
  • 21
  • Or better: `$('.ribbon.expired').closest('.listing-system').addClass('has-ribbon');` then add your styles to the `has-ribbon` class in CSS. – ESR Aug 04 '17 at 06:54
0

Hi this is working too

$(".ribbon.expired") .parentsUntil( ".listing-system" ) .css( "display", "none" );