html - Table with transparent border only on tbody -


table  {    background-color: lime;    border-collapse: collapse;  }    tr   {     border-width: 0 0 1px 0;    border-style: solid;  }  tr:last-child   {    border: none; // last child thead , tbody dont have border  }
<table>        <thead>          <th>rank</th>          <th>player</th>          <th>pts</th>      </thead>      <tbody>        <tr>          <td>1</td>          <td>player1</td>          <td>50</td>        </tr>        <tr>          <td>2</td>          <td>player2</td>          <td>40</td>        </tr>        <tr>          <td>3</td>          <td>player3</td>          <td>30</td>        </tr>        <tr>          <td>4</td>          <td>player4</td>          <td>40</td>        </tr>    </tbody>         </table>

now, want transparent border between rows, rows within tbody, not between thead , tbody. first, tried

table {   border-collapse: collapse;    tr {        border-width: 0 0 1px 0;       border-style: solid;   }   tr:last-child {       border: none; // last child thead , tbody dont have border   } } 

in case, border on element wanted, it's black , not transparent. tried border-spacing:

table {     border-spacing: 0 1px;     tr:last-child {         border: none;         border-spacing: none; //those 2 don't seem work     } } 

now have transparent borders, there borders before , after thead well, can't eliminate. so, have either: 1. border in tbody not between thead , first data row(good), borders not transparent(bad) or 2. transparent border(good), unwanted border between thead , first data row(bad).

is there way combine have transparent border, not between thead , first data row?

enter image description here

edit: want border full transparent, set border-color rgba(0,0,0,0), border "disappears". ok, doesn't disappeares, take background-color td(the lightgrey color, rgba value well) , have no idea why.

use border-color: rgba(0,0,0,.5);

<!doctype html>  <html>  <head>  <style>   table  {  background:yellow;  border-spacing: 0;  }     tbody tr:not(:last-of-type) td  {         border-width: 0 0 5px 0;        border-style: solid;        border-color:black;              border-color: rgba(0,0,0,.5);          }  </style>  </head>  <body>    <table>    <thead>      <th>rank</th>      <th>player</th>      <th>pts</th>  </thead>  <tbody>    <tr>      <td>1</td>      <td>player1</td>      <td>50</td>    </tr>    <tr>      <td>2</td>      <td>player2</td>      <td>40</td>    </tr>    <tr>      <td>3</td>      <td>player3</td>      <td>30</td>    </tr>    <tr>      <td>4</td>      <td>player4</td>      <td>40</td>    </tr>      </body>  </html>


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -