<div class="container">
<p class="viewport">Viewport width: <span class="c-viewport__width" id="vpWidth"></span>px
</p>
<table>
<tr>
<td>Random data</td>
<td>Random data</td>
<td>Random data</td>
<td>Random data</td>
</tr>
<tr>
<td>Random data</td>
<td>Random data</td>
<td>Random data</td>
<td>Random data</td>
</tr>
<tr>
<td>Random data</td>
<td>Random data</td>
<td>Random data</td>
<td>Random data</td>
</tr>
</table>
</div>
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
body {
background: #f0f0f0;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.container {
margin: 2em auto;
max-width: 45em;
border: 1px solid #aaa;
padding: 1em;
}
.viewport {
position: absolute;
font-size: 75%;
padding: 5px;
color: grey;
background: white;
top: 0;
left: calc(50% - 70px);
border-radius: 11px;
box-shadow: 1px 1px 5px 0px rgba(0,0,0,0.25);
}
table {
border-collapse: collapse;
width: 100%;
}
td {
border: 1px solid grey;
padding: 0.5em;
}
@media screen and (max-width: 35em) {
tr,
td {
display: block;
width: 100%;
}
}