0

How to select :nth-child() for all the elements in html except last element.

Is this valid=

  td:nth-child:not(last-child){

    //Some css//
    }

I am using text-overflow:ellipsis property to hide overflow from table in <td> elements.

It got successful with using even,odd children of this <td>. I want this ellipsis effects in all td blocks except last child of table.

I've given it a try-

.table-condensed tbody tr  td:nth-child:not(last-child) a
 {
     white-space: nowrap;
    text-overflow: ellipsis;
    width: 150px;
    display: block;
    overflow: hidden;

}

But that's is not a trick obviously. Any suggestions?

4

4 に答える 4

2

セレクターの一部として使用するだけtd:not(:last-child)で、各行の最後のセルを除くすべてのセルに一致します。

同様の例

セレクターにベアを含めた理由がまったくわかりません:nth-child-それで何を達成しようとしていますか?

于 2013-05-02T11:17:33.920 に答える