Question

How do I go about removing the bottom border from the very last row in my HTML table?

Here is the CSS:

#data {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid red;
}
#data th {
    text-decoration: underline;
    border: 1px solid blue;
}
#data td {
    border: 1px solid blue;
}
#data th, #data td {
  padding: 5px;
  text-align: left;
  width: 150px;
}
#data thead {
  background-color: #333333;
  color: #fdfdfd;
}
#data thead tr {
  display: block;
  position: relative;
}
#data tbody {
  display: block;
  overflow: auto;
  width: 100%;
  height: 300px;
}
#data tbody tr:nth-child(even) {
  background-color: #dddddd;
}

Here is a quick fiddle: http://jsfiddle.net/tZ9cA/

Was it helpful?

Solution

You could select the last table row child of tbody element and then subject all its <td> children as follows:

#data tbody > tr:last-child > td {
  border-bottom: 0;
}

WORKING DEMO

OTHER TIPS

Try this:

#data tr:last-child td{
    border-bottom:0;
}

The last-child selector will select the last row and then you can target all cells from there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top