我只需要为<span class="number">200</span>
写css,下面我已经给出了我使用的CSS代码,但是它不起作用,
这里是一个例子:
.statistics-inner div.stat span.number:nth-child(3){
font-size: 38px!important;
}
<div class="stat" data-count="1200">
<span class=""></span>
<span class="number">1200</span>
<span class="count-title">LINES OF CODES THIS MONTH</span>
</div>
<div class="stat" data-count="4800">
<span class=""></span>
<span class="number">4800</span>
<span class="count-title">TEST CASES WRITTEN</span>
</div>
<div class="stat" data-count="200">
<span class=""></span>
<span class="number">200</span>
<span class="count-title">INCREMENTAL RELEASE THIS YEAR</span>
</div>
<div class="stat" data-count="1000">
<span class=""></span>
<span class="number">1000</span>
<span class="count-title">COFFEE & TEA CUPS</span>
</div>
答案 0 :(得分:3)
nth-child(n)
需要添加到div.stat
:
.statistics-inner div.stat:nth-child(3) span.number {
font-size: 38px!important;
}
编辑:
如果data-count
是静态的而不是动态的,则也是属性选择器
.statistics-inner div.stat span.number[data-count="200"] {
font-size: 38px!important;
}