Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove the bottom border from the last row in my html table?

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/

like image 938
user1451890 Avatar asked Mar 19 '14 16:03

user1451890


1 Answers

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

like image 168
Hashem Qolami Avatar answered Sep 23 '22 03:09

Hashem Qolami