Responsive table using table layout

103 views Asked by At

I've been trying to figure out why my table is not displaying correctly on my screen when its at 600px. I tried it on codepen and its working okay there must be something stopping it from rendering properly on small screen.

(Demo)

@media screen and (max-width:600px){
    .sample{
        background:blue;
    }

    table {
      border: 0;

    }

    table thead {
      display: none;
    }

    table tr {
      margin-bottom: 10px;
      display: block;
      border-bottom: 2px solid #ddd;
        width:100%;
    }

    table td {
      display: block;
      text-align: right;
      font-size: 13px;
      border-bottom: 1px dotted #ccc;
        width:100%;
    }

    table td:last-child {
      border-bottom: 0;
    }

    table td:before {
      content: attr(data-label);
      float: left;
      text-transform: uppercase;
      font-weight: bold;
    }
}

This is what I get on my web browser at 600px.

enter image description here

0

There are 0 answers