
how to create a Sortable Tabular Data table
Before We Start
Every developers need, clean and modern elements to develop their websites, It contain pictures and a user interface element within a website. The most important one and the first section that the user sees when he/she enters a website. how to create a Sortable Tabular Data table
So if you are a person who wishes to develop a website, you have to know how to create that properly.

how to create a Sortable Tabular Data table
Download Udemy paid courses FREE
We are here to solve your problem. In this article we discuss how to create this elements. Before we start please read the below articles which easier you to understand the process, if you are new to development.
Step 1 – Add HTML
It’s too easy and simple. Just copy and paste below code in your HTML editor between <body> </body> tag.
<body>
<div id="wrapper">
<h1>Sortable Table of Search Queries</h1>
<table id="keywords" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th><span>Keywords</span></th>
<th><span>Impressions</span></th>
<th><span>Clicks</span></th>
<th><span>CTR</span></th>
<th><span>Rank</span></th>
</tr>
</thead>
<tbody>
<tr>
<td class="lalign">silly tshirts</td>
<td>6,000</td>
<td>110</td>
<td>1.8%</td>
<td>22.2</td>
</tr>
<tr>
<td class="lalign">desktop workspace photos</td>
<td>2,200</td>
<td>500</td>
<td>22%</td>
<td>8.9</td>
</tr>
<tr>
<td class="lalign">arrested development quotes</td>
<td>13,500</td>
<td>900</td>
<td>6.7%</td>
<td>12.0</td>
</tr>
<tr>
<td class="lalign">popular web series</td>
<td>8,700</td>
<td>350</td>
<td>4%</td>
<td>7.0</td>
</tr>
<tr>
<td class="lalign">2013 webapps</td>
<td>9,900</td>
<td>460</td>
<td>4.6%</td>
<td>11.5</td>
</tr>
<tr>
<td class="lalign">ring bananaphone</td>
<td>10,500</td>
<td>748</td>
<td>7.1%</td>
<td>17.3</td>
</tr>
</tbody>
</table>
</div>
</body>
Step 2 – Add CSS
Download Udemy paid courses FREE
Copy and paste below code in your HTML editor between <style></style> tag.
<style>
@import url("https://fonts.googleapis.com/css?family=Amarante");
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
outline: none;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
overflow-y: scroll;
}
body {
background: #eee url("https://i.imgur.com/eeQeRmk.png"); /* https://subtlepatterns.com/weave/ */
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 62.5%;
line-height: 1;
color: #585858;
padding: 22px 10px;
padding-bottom: 55px;
}
::selection {
background: #5f74a0;
color: #fff;
}
::-moz-selection {
background: #5f74a0;
color: #fff;
}
::-webkit-selection {
background: #5f74a0;
color: #fff;
}
br {
display: block;
line-height: 1.6em;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
}
ol,
ul {
list-style: none;
}
input,
textarea {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
outline: none;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: "";
content: none;
}
strong,
b {
font-weight: bold;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
img {
border: 0;
max-width: 100%;
}
h1 {
font-family: "Amarante", Tahoma, sans-serif;
font-weight: bold;
font-size: 3.6em;
line-height: 1.7em;
margin-bottom: 10px;
text-align: center;
}
/** page structure **/
#wrapper {
display: block;
width: 850px;
background: #fff;
margin: 0 auto;
padding: 10px 17px;
-webkit-box-shadow: 2px 2px 3px -1px rgba(0, 0, 0, 0.35);
}
#keywords {
margin: 0 auto;
font-size: 1.2em;
margin-bottom: 15px;
}
#keywords thead {
cursor: pointer;
background: #c9dff0;
}
#keywords thead tr th {
font-weight: bold;
padding: 12px 30px;
padding-left: 42px;
}
#keywords thead tr th span {
padding-right: 20px;
background-repeat: no-repeat;
background-position: 100% 100%;
}
#keywords thead tr th.headerSortUp,
#keywords thead tr th.headerSortDown {
background: #acc8dd;
}
#keywords thead tr th.headerSortUp span {
background-image: url("https://i.imgur.com/SP99ZPJ.png");
}
#keywords thead tr th.headerSortDown span {
background-image: url("https://i.imgur.com/RkA9MBo.png");
}
#keywords tbody tr {
color: #555;
}
#keywords tbody tr td {
text-align: center;
padding: 15px 10px;
}
#keywords tbody tr td.lalign {
text-align: left;
}
</style>
Step 3 – Add JavaScript
We use some external JavaScript link to this code. No need to worry about this, copy and paste below code between <head></head> tag.
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.14/js/jquery.tablesorter.min.js"></script>
</head>
And also copy and paste below JavaScript code between <script></script> tag.
<script>
$(function(){
$('#keywords').tablesorter();
});
</script>
At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

Video Tutorial
Please watch this video to better understand this tutorial and don’t forget to subscribe to our channel.
Download Udemy paid courses FREE
Help others to find out about this article on Social Media sites. If you have any doubt or any problem, don’t hesitate to contact us. Thereafter we will be able to help you and also make sure you bookmark our site on your browser.