Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply border radius to separated table rows that has horizontal scroll?

I have a table which has a lot of data, so it has to be scrolled horizontally. I have designed the table seperating each row as each seperate cards but I unable get the border-radius on the left and right part of the table row properly. If i scroll towards the end of the right, then i can see the radius on right and same on left. When you are in middle you do not see any border radius.

PS: Applying radius to first and last td does not work when there is horizontal scroll. :(

Is there any trick to fix this so both the sides of border radius is visible all the time ? I don't have much idea on table since it does take limited attributes. Or maybe we will need javascript to get the desired output ?

I am looking it to be like this on the image below, enter image description here

.page-wrapper {
  background-color: #f1f2f5;
}

table {
  white-space: nowrap;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table {
  position: relative;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table td,
.table th,
.table tr,
.table thead,
.table tbody {
  border: none;
  position: relative;
}

.table thead th {
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

tbody {
  position: relative;
}

tbody tr {
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}

tbody tr::after {
  content: '';
  width: 100%;
  position: absolute;
  left: 0;
  right: 0;
  background-color: #fff;
  height: 48px;
  z-index: 0;
  border-radius: 8px;
}

tbody td {
  z-index: 1;
}
<html lang="en" class="">

<head>
  <meta charset="UTF-8">
  <title>Demo</title>


  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

</head>

<body>
  <div class="page-wrapper">
    <div class="container pt-3">
      <div class="table-responsive">
        <table class="table no-wrap" style="
    position: relative;
">
          <thead>
            <tr>
              <th>SN</th>
              <th>Description 1</th>
              <th>Description 2</th>
              <th>Description 3</th>
              <th>Description 4</th>
              <th>Description 5</th>
              <th>Description 6</th>
              <th>Description 7</th>
              <th>Description 8</th>
              <th>Description 9</th>
              <th>Description 10</th>
              <th>Container</th>
              <th>Pickup Date</th>
              <th>Return Date</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
            <tr>
              <td>1</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>This Area is for text description</td>
              <td>UKS127398SLA</td>
              <td>2020-12-12</td>
              <td>2020-12-12</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>


</body>

</html>
like image 822
umanga shrestha Avatar asked Jun 01 '20 09:06

umanga shrestha


People also ask

How do you apply a border-radius to a table?

Use the CSS border-radius property to add rounded corners to the table cells.

How do you set a border-radius to a table in CSS?

CSS Syntaxborder-radius: 1-4 length|% / 1-4 length|%|initial|inherit; Note: The four values for each radius are given in the order top-left, top-right, bottom-right, bottom-left. If bottom-left is omitted it is the same as top-right. If bottom-right is omitted it is the same as top-left.

How do I add margins between table rows?

The space between two rows in a <table> can be added by using the CSS border-spacing and border-collapse properties. The border-spacing property is used to set the spaces between cells of a table, and the border-collapse property specifies whether the border of the table is collapsed or not.

How do I add a line between two rows in HTML?

The space between two rows in a table can be done using CSS border-spacing and border-collapse property. The border-spacing property is used to set the spaces between cells of a table and border-collapse property is used to specify whether the border of table is collapse or not.


1 Answers

Here is a trick with position:sticky that seems to work fine only on Chrome (checking with firefox).

tbody tr::after,
tbody tr::before {
    content: '';
    display: block;
    position: sticky;
    right: 0; /* one will stick to the right */
    left: 0;  /* the other to the left */
    box-shadow:30px 0 0 6px #f1f2f5; /* a box-shadow to hide the outside */
    height: 48px;
    margin-left: -50px; /* big enough for the radius you will be using */
    z-index: 9;
    border-radius: 0 30px 30px 0; /* your radius */
}
tbody tr::before {
    margin-right: -50px;
    margin-left:0;    
    box-shadow:-30px 0 0 6px #f1f2f5;
    border-radius: 30px 0 0 30px;
}
thead tr::after,
thead tr::before  {
  content:"";
  display:block;
}
tbody td {
  background:#fff;
}

Full code:

var wrapper = document.querySelector("tbody");
var myHTML = '';

for (var i = 0; i < 5; i++) {
  myHTML += '<tr>' +
    '<td>1</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>UKS127398SLA</td>' +
    '<td>2020-12-12</td>' +
    '<td>2020-12-12</td>' +
    '</tr>';
}

wrapper.innerHTML = myHTML;
.page-wrapper {
  background-color: #f1f2f5;
}

table {
  white-space: nowrap;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table {
  position: relative;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table td,
.table th,
.table tr,
.table thead,
.table tbody {
  border: none;
  position: relative;
}

.table thead th {
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

tbody {
  position: relative;
}

tbody tr {
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}

tbody tr::after,
tbody tr::before {
    content: '';
    display: block;
    position: sticky;
    right: 0;    
    left: 0;
    box-shadow:30px 0 0 6px #f1f2f5;
    height: 48px;
    margin-left: -50px;
    z-index: 9;
    border-radius: 0 30px 30px 0;
}
tbody tr::before {
    margin-right: -50px;
    margin-left:0;    
    box-shadow:-30px 0 0 6px #f1f2f5;
    border-radius: 30px 0 0 30px;
}
thead tr::after,
thead tr::before  {
  content:"";
  display:block;
}

tbody td {
  background:#fff;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

  <div class="page-wrapper">
    <div class="container pt-3">
      <div class="table-responsive">
        <table class="table no-wrap" style="
    position: relative;
">
          <thead>
            <tr>
              <th>SN</th>
              <th>Description 1</th>
              <th>Description 2</th>
              <th>Description 3</th>
              <th>Description 4</th>
              <th>Description 5</th>
              <th>Description 6</th>
              <th>Description 7</th>
              <th>Description 8</th>
              <th>Description 9</th>
              <th>Description 10</th>
              <th>Container</th>
              <th>Pickup Date</th>
              <th>Return Date</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>
      </div>
    </div>
  </div>

Another idea using mask where you can have transparency and will work on Firefox

.table-responsive {
    mask: 
      radial-gradient(circle 25px at right,transparent 98%,#fff 100%) 0    41px/27px 59px repeat-y,
      radial-gradient(circle 25px at left ,transparent 98%,#fff 100%) 100% 41px/27px 59px repeat-y,
      linear-gradient(#fff,#fff);
    mask-composite: exclude;
}

Full code

var wrapper = document.querySelector("tbody");
var myHTML = '';

for (var i = 0; i < 5; i++) {
  myHTML += '<tr>' +
    '<td>1</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>UKS127398SLA</td>' +
    '<td>2020-12-12</td>' +
    '<td>2020-12-12</td>' +
    '</tr>';
}

wrapper.innerHTML = myHTML;
.page-wrapper {
  background-color: #f1f2f5;
}

table {
  white-space: nowrap;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table {
  position: relative;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table td,
.table th,
.table tr,
.table thead,
.table tbody {
  border: none;
  position: relative;
}

.table thead th {
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

tbody {
  position: relative;
}

tbody tr {
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}

tbody td {
  background: #fff;
}

.table-responsive {
  -webkit-mask: radial-gradient(circle 25px at right, transparent 98%, #fff 100%) 0 41px/27px 59px repeat-y, radial-gradient(circle 25px at left, transparent 98%, #fff 100%) 100% 41px/27px 59px repeat-y, linear-gradient(#fff, #fff);
  -webkit-mask-composite: destination-out;
  mask: radial-gradient(circle 25px at right, transparent 98%, #fff 100%) 0 41px/27px 59px repeat-y, radial-gradient(circle 25px at left, transparent 98%, #fff 100%) 100% 41px/27px 59px repeat-y, linear-gradient(#fff, #fff);
  mask-composite: exclude;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

<div class="page-wrapper">
  <div class="container pt-3">
    <div class="table-responsive">
      <table class="table no-wrap" style="
    position: relative;
">
        <thead>
          <tr>
            <th>SN</th>
            <th>Description 1</th>
            <th>Description 2</th>
            <th>Description 3</th>
            <th>Description 4</th>
            <th>Description 5</th>
            <th>Description 6</th>
            <th>Description 7</th>
            <th>Description 8</th>
            <th>Description 9</th>
            <th>Description 10</th>
            <th>Container</th>
            <th>Pickup Date</th>
            <th>Return Date</th>
          </tr>
        </thead>
        <tbody>
        </tbody>
      </table>
    </div>
  </div>
</div>

To have any kind of radius we can replace the radial-gradient with an SVG where you can control the rx/ry to define the radius:

.table-responsive {
    mask: 
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="0"   y="0" rx="10" ry="10" width="100" height="49" fill="black"/></svg>') 0    47px/27px 59px repeat-y,
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-50" y="0" rx="10" ry="10" width="77"  height="49" fill="black"/></svg>') 100% 47px/27px 59px repeat-y,
      linear-gradient(#fff,#fff) center/calc(100% - 27px*2) 100% no-repeat;
}

var wrapper = document.querySelector("tbody");
var myHTML = '';

for (var i = 0; i < 5; i++) {
  myHTML += '<tr>' +
    '<td>1</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>UKS127398SLA</td>' +
    '<td>2020-12-12</td>' +
    '<td>2020-12-12</td>' +
    '</tr>';
}

wrapper.innerHTML = myHTML;
.page-wrapper {
  background-color: #f1f2f5;
}

table {
  white-space: nowrap;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table {
  position: relative;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table td,
.table th,
.table tr,
.table thead,
.table tbody {
  border: none;
  position: relative;
}

.table thead th {
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

tbody {
  position: relative;
}

tbody tr {
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}


tbody td {
  background:#fff;
}

.table-responsive {
     -webkit-mask:
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="0" y="0" rx="15" ry="15" width="100" height="49" fill="black"/></svg>') 0    47px/27px 59px repeat-y,
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-50" y="0" rx="15" ry="15" width="77" height="49" fill="black"/></svg>') 100% 47px/27px 59px repeat-y,
      linear-gradient(#fff,#fff) center/calc(100% - 27px*2) 100% no-repeat;
    mask: 
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="0"  y="0" rx="15" ry="15" width="100" height="49" fill="black"/></svg>') 0    47px/27px 59px repeat-y,
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-50" y="0" rx="15" ry="15" width="77" height="49" fill="black"/></svg>') 100% 47px/27px 59px repeat-y,
      linear-gradient(#fff,#fff) center/calc(100% - 27px*2) 100% no-repeat;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

  <div class="page-wrapper">
    <div class="container pt-3">
      <div class="table-responsive">
        <table class="table no-wrap" style="
    position: relative;
">
          <thead>
            <tr>
              <th>SN</th>
              <th>Description 1</th>
              <th>Description 2</th>
              <th>Description 3</th>
              <th>Description 4</th>
              <th>Description 5</th>
              <th>Description 6</th>
              <th>Description 7</th>
              <th>Description 8</th>
              <th>Description 9</th>
              <th>Description 10</th>
              <th>Container</th>
              <th>Pickup Date</th>
              <th>Return Date</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>
      </div>
    </div>
  </div>

A final idea (the most supported one) is to consider an ovelay with the same technique of the SVG above. This won't have transparency:

.container > div{
  position:relative;
}
.container > div::after {
 content:"";
 position:absolute;
 top:47px;
 left:0;
 right:0;
 bottom:0;
 background: 
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-10"  y="-10" rx="20" ry="20" width="100" height="69" fill="transparent" stroke="%23f1f2f5" stroke-width="20"/></svg>') 0    0,
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-50"  y="-10" rx="20" ry="20" width="87"  height="69" fill="transparent" stroke="%23f1f2f5" stroke-width="20"/></svg>') 100% 0;
  background-size:27px 59px;
  background-repeat:repeat-y;
  pointer-events:none;
}

Full code

var wrapper = document.querySelector("tbody");
var myHTML = '';

for (var i = 0; i < 5; i++) {
  myHTML += '<tr>' +
    '<td>1</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>UKS127398SLA</td>' +
    '<td>2020-12-12</td>' +
    '<td>2020-12-12</td>' +
    '</tr>';
}

wrapper.innerHTML = myHTML;
.page-wrapper {
  background-color: #f1f2f5;
}

table {
  white-space: nowrap;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table {
  position: relative;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table td,
.table th,
.table tr,
.table thead,
.table tbody {
  border: none;
  position: relative;
}

.table thead th {
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

tbody {
  position: relative;
}

tbody tr {
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}


tbody td {
  background:#fff;
}

.container > div{
  position:relative;
}
.container > div::after {
 content:"";
 position:absolute;
 top:47px;
 left:0;
 right:0;
 bottom:0;
 background: 
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-10"  y="-10" rx="20" ry="20" width="100" height="69" fill="transparent" stroke="%23f1f2f5" stroke-width="20"/></svg>') 0    0,
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-50" y="-10" rx="20" ry="20" width="87" height="69" fill="transparent" stroke="%23f1f2f5" stroke-width="20"/></svg>') 100% 0;
  background-size:27px 59px;
  background-repeat:repeat-y;
  pointer-events:none;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

  <div class="page-wrapper">
    <div class="container pt-3">
    <div>
      <div class="table-responsive">
        <table class="table no-wrap" style="
    position: relative;
">
          <thead>
            <tr>
              <th>SN</th>
              <th>Description 1</th>
              <th>Description 2</th>
              <th>Description 3</th>
              <th>Description 4</th>
              <th>Description 5</th>
              <th>Description 6</th>
              <th>Description 7</th>
              <th>Description 8</th>
              <th>Description 9</th>
              <th>Description 10</th>
              <th>Container</th>
              <th>Pickup Date</th>
              <th>Return Date</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>
      </div>
    </div>
    </div>
  </div>

UPDATE

Considering vertical scroll in addition to the horizontal one using the last method:

var wrapper = document.querySelector("tbody");
var myHTML = '';

for (var i = 0; i < 10; i++) {
  myHTML += '<tr>' +
    '<td>1</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>This Area is for text description</td>' +
    '<td>UKS127398SLA</td>' +
    '<td>2020-12-12</td>' +
    '<td>2020-12-12</td>' +
    '</tr>';
}

wrapper.innerHTML = myHTML;
.page-wrapper {
  background-color: #f1f2f5;
}

table {
  white-space: nowrap;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table {
  position: relative;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table td,
.table th,
.table tr,
.table thead,
.table tbody {
  border: none;
  position: relative;
}

.table thead th {
  border: none;
  padding-top: 0;
  padding-bottom: 0;
}

tbody {
  position: relative;
}

tbody tr {
  border-radius: 8px;
  margin-bottom: 20px;
  position: relative;
}


tbody td {
  background:#fff;
}

.container > div{
  position:relative;
  display:grid;
  grid-template-columns:100% 1fr;
  max-height: 400px;
  overflow: auto;
}
.container > div > .table-responsive {
  grid-row:1;
  grid-column:1/span 2;
}
.container > div::after {
 content:"";
 display:block;
 grid-row:1;
 grid-column:1;    
 z-index: 2;
 margin-top: 47px;
 background: 
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-10"  y="-10" rx="20" ry="20" width="100" height="69" fill="transparent" stroke="%23f1f2f5" stroke-width="20"/></svg>') 0    0,
      url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 27 59"><rect x="-50" y="-10" rx="20" ry="20" width="87" height="69" fill="transparent" stroke="%23f1f2f5" stroke-width="20"/></svg>') 100% 0;
  background-size:27px 59px;
  background-repeat:repeat-y;
  pointer-events:none;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css">

  <div class="page-wrapper">
    <div class="container pt-3">
    <div>
      <div class="table-responsive">
        <table class="table no-wrap" style="
    position: relative;
">
          <thead>
            <tr>
              <th>SN</th>
              <th>Description 1</th>
              <th>Description 2</th>
              <th>Description 3</th>
              <th>Description 4</th>
              <th>Description 5</th>
              <th>Description 6</th>
              <th>Description 7</th>
              <th>Description 8</th>
              <th>Description 9</th>
              <th>Description 10</th>
              <th>Container</th>
              <th>Pickup Date</th>
              <th>Return Date</th>
            </tr>
          </thead>
          <tbody>
          </tbody>
        </table>
      </div>
    </div>
    </div>
  </div>
like image 74
Temani Afif Avatar answered Nov 10 '22 00:11

Temani Afif