-1

I have two <tr> elements with different color borders. The appearance is visable in the attached picture. How can I make it so they each have their own border or in other words have the lower blue one show it's upper border as well? Preferably with css.

enter image description here

Zachscs
  • 3,353
  • 7
  • 27
  • 52

1 Answers1

0

Adding borders to tr elements is kind of problematic. You should target your styles to the td elements inside.

JSFiddle: https://jsfiddle.net/72pg7xry/

table {
    border-spacing: 0;
}

tr.blue td  {
  border-top: 5px solid blue;
  border-bottom: 5px solid blue;
}

tr.blue td:first-child {
  border-left: 5px solid blue;
}

tr.blue td:last-child {
  border-right: 5px solid blue;
}

tr.green td {
  border-top: 5px solid green;
  border-bottom: 5px solid green;
}

tr.green td:first-child {
  border-left: 5px solid green;
}

tr.green td:last-child {
  border-right: 5px solid green;
}

Here's more info on why styling tr is tricky: Add border-bottom to table row <tr>

Chris Riebschlager
  • 1,323
  • 1
  • 8
  • 12