Last of type

Hey,

If I ahve a table as follows:

<table class="NLTR">
<thead>
<tr><td colspan="3">Hello</td></tr>
</thead>
<tbody><tr><td>1</td><td>2</td</tr><tr><td>1</td><td>2</td</tr><tr><td>1</td><td>2</td</tr><tr><td>1</td><td>2</td</tr><tr><td>1</td><td>2</td</tr><tr><td>1</td><td>2</td</tr></tbody></table>

I want to add a bottom border to every td except the one in the thead elemtn and not the last row.

I have got:

.NLTR tbody td
{
border-bottom: 1px solid black;
}

.NLTR tbody td:last-of-type
{
border-bottom: 0px solid black;
}

But then just read online that last-of-type actually means last of type in it’s parent tag so thats why the second td of each row is getting no bottom border.

How could I go about doing as I really want?

Neil

Between the elements “tbody” and “td”, there is “tr”.
Use:
<style>
.NLTR tbody tr td
{
border-bottom: 1px solid black;
}

.NLTR tbody tr:last-of-type td
{
border-bottom: 0px solid black;
}
</style>

Excellent, Thanks

One more question. I ahve put bottom borders on the td’s but I have 2 td’s per row and each has a bottom border but there is a very small split in the line between each td. Could I make the row have the bottom border instead of the td’s?

Yes, I added the table property “border-collaps” as follows:
.NLTR {
border-collapse: collapse;
}

Don’t forget the “!DOCTYPE”.

Click here for more info about table styling.