mardi 4 août 2015

Table with enumerated rows except the last one

How can I have a table with numerated rows except the last row? I was trying below code but it does not work :(

EDIT: Below code works in Chrome and Firefox but not in Safari. I don't know about IE yet

table.enumerated {
    counter-reset: rowNumber;
}

table.enumerated > tbody > tr {
    counter-increment: rowNumber;
}

table.enumerated > tbody > tr > td:first-child::before {
    content: counter(rowNumber);
    min-width: 1em;
}
table.enumerated > tbody > tr:last-child > td:first-child::before {
    content: unset;
}
<table border="1" class="enumerated">
    <tr>
        <td></td><td>one</td>
    </tr>
    <tr>
        <td></td><td>two</td>
    </tr>
    <tr>
        <td></td><td>three</td>
    </tr>
    <tr>
        <td class='no-number'></td><td>no number</td>
    </tr>
</table>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire