0

我希望以下(每 5 个具有“.span-tag”类的元素)与 IE 7/8 兼容

.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>
4

2 回答 2

2

我不确定您的问题,但您可以使用链接- selectivizr 是一个 JavaScript 实用程序,可模拟 Internet Explorer 6-8 中的 CSS3 伪类和属性选择器

于 2013-10-02T09:59:19.387 回答
0

The only way to do this without using nth-child be be very very verbose (You would have to target each 5n-th case separately) -

If you know the upper limit of the amount of span-tag classes - then it might be viable this way, otherwise - you're out of luck. :

.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;
}

etc

于 2013-10-02T10:10:34.600 回答