JSFiddle - React, Tailwind, and code Playground
by NicoO
HTML
<div id="wrap">
<div id="table-container">
<table>
<colgroup>
<col style="width: 40px;"/>
<col style="width: 144px;"/>
</colgroup>
<thead>
<tr>
<th><span>col1</span></th>
<th>
<span>col2</span>
<button id="toggle-overlay">Toggle Menu</button>
<div id="overlay">
<p>Hi! I'am a overlay. I'am set to positio fixed, so i should have my own viewpoint.</p>
</div>
</th>
</tr>
</thead>
<tbody>
<tr><td>1</td><td>2</td></tr>
<tr><td>3</td><td>4</td></tr>
</tbody>
</table>
</div>
</div>
CSS
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html,
body
{
height: 100%;
width: 100%;
overflow: hidden;
}
#wrap
{
bottom: 0;
clear: both;
left: 0;
overflow: auto;
position: absolute;
right: 0;
top: 0;
}
#table-container
{
left: 0;
margin-top: 0;
padding-left: 0;
padding-right: 0;
position: absolute;
top: 0;
width: 400px;
z-index: 2;
border-bottom: 1px solid hsl(0, 0%, 100%);
box-shadow: 0 2px 2px hsla(220, 74%, 33%, 0.1);
overflow: hidden;
background-color: gray;
}
table
{
margin: 0;
table-layout: fixed;
width: 104.382%;
border: 0 none;
border-collapse: collapse;
border-spacing: 0;
background-color: green;
}
#overlay
{
top: 30px;
left: 20px;
right: 20px;
position: fixed;
background-color: yellow;
height: 200px;
}
JavaScript
$(function(){
$("#toggle-overlay").click(function(){
$('#overlay').toggle();
});
});