Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to do conditional css on table row?

Tags:

html

css

asp.net

I have a css that I need to work on IE8. So I cannot use last-child. As a trick I use

table#GridViewMemory tr:first-child + tr + tr + tr + tr + tr + tr + tr + tr + tr + tr + tr + tr + tr td {
    display:table-cell;
}

to show the 13th row of a table. my table only have two columns

the reason I only want to show the 13th row is because this is a gridview in aspx (vb.net) and the 13th row is the pagination (a link to click page 1 page 2 page 3 and ...)

the problem is the table is not always 12 row. on the last page of the gridview. it could be anywhere between 1 to 12 row.

is it possible to check this using css .. for example:

  • if 1 row then show 2nd row only
  • if 2 row then show 3rd row only
  • if 3 row then show 4rd row only
  • ...
  • ...
  • ...
  • if 12 row then show 13th row only
    <tbody><tr>
        <th scope="col"><a href="">Column1</a></th><th scope="col"><a href="">Column2</a></th>
    </tr><tr>
        <td>31424-1</td><td>1</td>
    </tr><tr>
        <td>31275-1</td><td>1</td>
    </tr><tr>
        <td>31226-9</td><td>1</td>
    </tr><tr>
        <td>30982-1</td><td>1</td>
    </tr><tr>
        <td>30936-5</td><td>1</td>
    </tr><tr>
        <td>30915-1</td><td>1</td>
    </tr><tr>
        <td>30674-4</td><td>1</td>
    </tr><tr>
        <td>31366-5</td><td>2</td>
    </tr><tr>
        <td>31353-2</td><td>2</td>
    </tr><tr>
        <td>31353-1</td><td>2</td>
    </tr><tr>
        <td>31305-1</td><td>2</td>
    </tr><tr>
        <td>31273-1</td><td>2</td>
    </tr><tr>
        <td colspan="2"><table>
            <tbody><tr>
                <td><span>1</span></td><td><a href="">2</a></td><td><a href="">3</a></td><td><a href="">4</a></td><td><a href="">5</a></td>
            </tr>
        </tbody></table></td>
    </tr>
</tbody>

I tried using this solution but it only shows the last td cell . but not the table inside the last row. Any suggestions or comments?? Thanks

table#GridViewMemory tr td[colspan="2"] {
    display:table-cell;
}
like image 434
BobNoobGuy Avatar asked Nov 22 '25 02:11

BobNoobGuy


1 Answers

This is unpossible with a modern and easy way. Because IE8 is at least a crap browser. The best way is to set a class in the lastchild with ASPX

like image 121
MarvinK Avatar answered Nov 24 '25 17:11

MarvinK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!