TablesTutorials

how to create a Responsive table

how to create a Responsive table

how to create a Responsive 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 Responsive 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 Responsive 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.

<table class="container">
  <thead>
    <tr>
      <th>
        <h1>Sites</h1>
      </th>
      <th>
        <h1>Views</h1>
      </th>
      <th>
        <h1>Clicks</h1>
      </th>
      <th>
        <h1>Average</h1>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Google</td>
      <td>9518</td>
      <td>6369</td>
      <td>01:32:50</td>
    </tr>
    <tr>
      <td>Twitter</td>
      <td>7326</td>
      <td>10437</td>
      <td>00:51:22</td>
    </tr>
    <tr>
      <td>Amazon</td>
      <td>4162</td>
      <td>5327</td>
      <td>00:24:34</td>
    </tr>
    <tr>
      <td>LinkedIn</td>
      <td>3654</td>
      <td>2961</td>
      <td>00:12:10</td>
    </tr>
    <tr>
      <td>CodePen</td>
      <td>2002</td>
      <td>4135</td>
      <td>00:46:19</td>
    </tr>
    <tr>
      <td>GitHub</td>
      <td>4623</td>
      <td>3486</td>
      <td>00:31:52</td>
    </tr>
  </tbody>
</table>

Step 2 – Add CSS

Download Udemy paid courses FREE

Copy and paste below code in your HTML editor between <style></style> tag.

<style>
@charset "UTF-8";
@import url(https://fonts.googleapis.com/css?family=Open + Sans:300, 400, 700);

body {
  font-family: "Open Sans", sans-serif;
  font-weight: 300;
  line-height: 1.42em;
  color: #a7a1ae;
  background-color: #1f2739;
}

h1 {
  font-size: 3em;
  font-weight: 300;
  line-height: 1em;
  text-align: center;
  color: #4dc3fa;
}

h2 {
  font-size: 1em;
  font-weight: 300;
  text-align: center;
  display: block;
  line-height: 1em;
  padding-bottom: 2em;
  color: #fb667a;
}

h2 a {
  font-weight: 700;
  text-transform: uppercase;
  color: #fb667a;
  text-decoration: none;
}

.blue {
  color: #185875;
}
.yellow {
  color: #fff842;
}

.container th h1 {
  font-weight: bold;
  font-size: 1em;
  text-align: left;
  color: #185875;
}

.container td {
  font-weight: normal;
  font-size: 1em;
  -webkit-box-shadow: 0 2px 2px -2px #0e1119;
  -moz-box-shadow: 0 2px 2px -2px #0e1119;
  box-shadow: 0 2px 2px -2px #0e1119;
}

.container {
  text-align: left;
  overflow: hidden;
  width: 80%;
  margin: 0 auto;
  display: table;
  padding: 0 0 8em 0;
}

.container td,
.container th {
  padding-bottom: 2%;
  padding-top: 2%;
  padding-left: 2%;
}

/* Background-color of the odd rows */
.container tr:nth-child(odd) {
  background-color: #323c50;
}

/* Background-color of the even rows */
.container tr:nth-child(even) {
  background-color: #2c3446;
}

.container th {
  background-color: #1f2739;
}

.container td:first-child {
  color: #fb667a;
}

.container tr:hover {
  background-color: #464a52;
  -webkit-box-shadow: 0 6px 6px -6px #0e1119;
  -moz-box-shadow: 0 6px 6px -6px #0e1119;
  box-shadow: 0 6px 6px -6px #0e1119;
}

.container td:hover {
  background-color: #fff842;
  color: #403e10;
  font-weight: bold;

  box-shadow: #7f7c21 -1px 1px, #7f7c21 -2px 2px, #7f7c21 -3px 3px,
    #7f7c21 -4px 4px, #7f7c21 -5px 5px, #7f7c21 -6px 6px;
  transform: translate3d(6px, -6px, 0);

  transition-delay: 0s;
  transition-duration: 0.4s;
  transition-property: all;
  transition-timing-function: line;
}

@media (max-width: 800px) {
  .container td:nth-child(4),
  .container th:nth-child(4) {
    display: none;
  }
}
</style>

At the end we will have something like this. You can change fonts, colors, backgrounds and all things that you want. Enjoy it.

how to create a Responsive table

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.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button