Skip to content

Instantly share code, notes, and snippets.

@o-nkar
Created February 19, 2021 07:42
Show Gist options
  • Save o-nkar/8e4493bd2fc859ae3d5455d6826176f6 to your computer and use it in GitHub Desktop.
Save o-nkar/8e4493bd2fc859ae3d5455d6826176f6 to your computer and use it in GitHub Desktop.
@media only screen and (max-width: 760px),(min-device-width: 768px) and (max-device-width: 1024px){
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr { border: 1px solid #ccc; }
td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
}
/*
Label the data
*/
td:nth-of-type(1):before { content: "ID"; }
td:nth-of-type(2):before { content: "ORDER NUMBER"; }
td:nth-of-type(3):before { content: "NAME"; }
td:nth-of-type(4):before { content: "QUANTITY"; }
td:nth-of-type(5):before { content: "TOTAL AMOUNT"; }
td:nth-of-type(6):before { content: "BOOKING DATE"; }
td:nth-of-type(7):before { content: "TRIP DATE"; }
td:nth-of-type(8):before { content: "STATUS"; }
td:nth-of-type(9):before { content: "VIEW"; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment