2013-10-02 50 views
0

我想以下(每5元素與類「.span標籤」)作爲與IE 7/8第n個孩子轉化爲IE支持

.taggar .row-fluid .span-tag:nth-child(5n), 
    margin-left: 0; 
} 

我已經試過以下兼容,但它不工作,所以可能我錯了,這樣做:

.taggar .row-fluid .span-tag:first-child + .span-tag .span-tag .span-tag .span-tag { 
    margin-left: 0; 
} 

HTML:

<div class="action-container container taggar"> 
    <div class="row-fluid"> 
     <div class="span3 span-tag"> 
      <a href="#"><div class="tag label btn-tag tags"><span>foo1</span></div><span class="votes">x 61</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo2</span></div><span class="votes">x 52</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo3</span></div><span class="votes">x 387</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo4</span></div><span class="votes">x 343</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo5</span></div><span class="votes">x 434</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo6</span></div><span class="votes">x 4</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo7</span></div><span class="votes">x 134</span></a> 
     </div> 
     <div class="span3 span-tag"> 
      <a href=""><div class="tag label btn-tag tags"><span>foo8</span></div><span class="votes">x 32</span></a> 
     </div>  
    </div> 
</div> 
+0

添加到您的html ..... –

+0

@ C-鏈接:OK,大功告成了! – holyredbeard

+1

我不認爲這可以做到沒有使用第n個孩子 – Danield

回答

2

我不是t確定你的問題,但你可以使用a link - selectivizr是一個JavaScript實用程序,模擬CSS3僞類和屬性選擇器在Internet Explorer 6-8

0

不使用nth-child做到這一點的唯一方法是非常非常詳細(你必須單獨針對每個第5個案例) -

如果你知道span-tag類的數量的上限 - 那麼它可能是可行的,否則 - 你已經沒有了運氣。 :

.span-tag:first-child + .span-tag + .span-tag + .span-tag + .span-tag { /* 5 times */ 
    margin-left: 0; 
} 

.span-tag:first-child + .span-tag + ... + .span-tag { /* 10 times */ 
    margin-left: 0; 
} 

.span-tag:first-child + .span-tag + ... + .span-tag { /* 15 times */ 
    margin-left: 0; 
}