Ich habe Mühe herauszufinden, warum ich nth-of-type (even) und nth-of-type (odd) nicht korrekt in meinem Markup verwenden kann. Ich habe viele Variationen ausprobiert und ein xpath/css Chrome-Browser-Tool verwendet, um zu verifizieren, dass jede Instanz meines Elements news-item-card-header gleichwertig ist. Wenn es in meinem Beispiel richtig funktionieren würde, würde der untere Rand die Farben wechseln.nth-of-type ergibt sogar für jedes Element Mystery
<!-- Card Begin -->
<div class="col-xs-12">
<div class="col-xs-2"></div>
<div class="col-xs-8">
<div class="ui fluid card">
<div class="content">
<div class="header card-header">
<span class="glyphicon glyphicon-user"></span>
<span class="news-item-card-header">
John Doe is a new contact at the Advisor Group
</span>
</div>
<div class="description" style="padding-top:15px">
Contact him for Portfolio Platform offerings (GEARS, Step Securities, CDs); ECAP Strategy Guide
</div>
</div>
</div>
</div>
<div class="col-xs-2"></div>
</div>
<!-- Card end -->
CSS:
.news-item-card-header:nth-of-type(odd) {
border-bottom: 2px solid #143F6E;
}
.news-item-card-header:nth-of-type(even) {
border-bottom: 1px solid #FAAA41;
}
JSFiddle: https://jsfiddle.net/schins02/gmgztuwj/
Vielen Dank für jede Hilfe