Converting blogger HTML tables into Smart Responsive tables using CSS

Requirement: Make all HTML Tables in Blogspot responsive ,pretty & a bit smarter.
How: Its 2 step process.
  1. Add CSS for styling to template
  2. Modify your Table Structure accordingly.
Here is the link  of the post having table with formatting provided below to see things in action, try changing size of browser to see how it adapts to various screen sizes.

Here are some screenshots as well:

On Desktop:
 On Mobile/Tablets/Phones:


1:Add the following CSS code in template from HTML editor:
table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  table-layout: fixed;

table caption {
  font-size: 1.5em;
  margin: .5em 0 .75em;

table tr {
  background-color: white;
  border: 1px solid #ddd;
  padding: .35em;

table th,
table td {
  padding: .625em;
  text-align: center;

table th {
  font-size: .85em;
  letter-spacing: .1em;
  text-transform: uppercase;
  background-color: white;
  table td {border-left: 1px solid #ddd;}
  table tr:nth-child(odd) {
  background-color: #f2f2f2;
@media screen and (max-width: 600px) {
  table {
    border: 0;

  table caption {
    font-size: 1.3em;
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .8em;
    text-align: right;
  table td {border-left: 0px;}
  table td::before {
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  table td:last-child {
    border-bottom: 0;

2:Change your tables html structure as shown for below example table, observe data-label attribute in each td tag these turns into headings in small screens such as mobile/tablets <td data-label="Server Name">:
<tr><th>Server Name</th><th>Trace Flag</th><th>Status</th><th>Global</th><th>Session</th></tr>
<tr><td data-label="Server Name">PRD-MSSQL01C</td><td data-label="Trace Flag">1222</td><td data-label="Status">1</td><td data-label="Global">1</td><td data-label="Session">0</td></tr>
<tr><td data-label="Server Name">PRD-MSSQL01C</td><td data-label="Trace Flag">1224</td><td data-label="Status">1</td><td data-label="Global">1</td><td data-label="Session">0</td></tr>
<tr><td data-label="Server Name">PRD-MSSQL01C</td><td data-label="Trace Flag">4136</td><td data-label="Status">1</td><td data-label="Global">1</td><td data-label="Session">0</td></tr>

That's it...clear browser cache and hit reload!


Popular posts from this blog

Adding Home Older Newer Post Buttons in new Blogger templates such as Contempo

Adding copy to clipboard button to every google code prettify pre blocks in blogger

Enabling fixed Sidebar for blogger Contempo template for screen sizes smaller than 1440px