我想仅为CSS
类添加listing-system
,但为“expired
”添加子类。我是如何努力为它写CSS
的,任何人都可以帮助我。感谢
<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 --
答案 0 :(得分:0)
你可以通过Jquery这样做,如果你想选择一个类&#39; .listing-system&#39;它有一个儿童班&#39; .ribbon.expired&#39;,
$('.ribbon.expired').closest('.listing-system').css('your css style goes here');
答案 1 :(得分:0)
嗨,这也有效
$(".ribbon.expired") .parentsUntil( ".listing-system" ) .css( "display", "none" );