JSFiddle - React, Tailwind, and code Playground
by Hristiyan Dodov
HTML
<table>
<tbody>
<tr><td>Josh</td><td class="pop">3 BTC</td><td>$46,343</td><td>27/12/17</td></tr>
<tr><td>Anne</td><td class="pop">2 BTC (veeery big cell)</td><td>$38,452</td><td>26/12/17</td></tr>
<tr><td>Jack</td><td class="pop">6 BTC<br><small>bigger</small></td><td>$126,989</td><td>26/12/17</td></tr>
<tr><td>Gyumur</td><td class="pop">0.7 BTC</td><td>$14,104</td><td>24/12/17</td></tr>
<tr><td>Boggy</td><td class="pop">12 BTC</td><td>$267,766</td><td>21/12/17</td></tr>
</tbody>
</table>
SCSS
$background-pull-x: -20px;
$background-pull-y: -25px;
$border-size: 1px;
$border-main: $border-size solid rgba(0, 0, 0, 0.05);
$radius-main: 5px;
table {
margin: 30px;
background: #F0F6F7;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.16);
border-radius: $radius-main;
border-collapse: collapse;
}
tr {
display: block; // needed for the :after pseudo element
position: relative;
// Used for the hover highlight effect.
&:after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: none;
pointer-events: none;
}
&:hover:after {
background: rgba(#FFF, 0.2);
}
& + tr {
&:after {
// Border must not be highlighted by hover effect.
top: $border-size;
}
// All `td` (including `.pop`) must have border-top so they can be aligned
// properly. The pseudo element need it to get its background darkened.
td,
td.pop:before {
border-top: $border-main;
}
td.pop:before,
td.pop:after {
// To pull themselves ontop the border.
top: -$border-size;
}
}
&:first-child {
.pop:after,
.pop:before {
top: -10px;
border-top-left-radius: $radius-main;
border-top-right-radius: $radius-main;
}
}
&:last-child {
.pop:after,
.pop:before {
bottom: -10px;
border-bottom-left-radius: $radius-main;
border-bottom-right-radius: $radius-main;
}
}
}
td {
min-width: 150px;
...