JSFiddle - React, Tailwind, and code Playground
HTML
<!-- Add borderSpec to the table's class, so it has the
expected border when you start -->
<table id="tbWorking" class="tbTest borderSpec">
<tr class="trTest">
<th class="tdTest">Col1</th>
<th class="tdTest">Col2</th>
</tr>
<tr class="trTest">
<td class="tdTest">c</td>
<td class="tdTest">d</td>
</tr>
<tr class="trTest">
<td class="tdTest">e</td>
</tr>
</table>
<script type="text/javascript" src="TempTestingTables.js"></script>
CSS
/* Split the CSS into something specific to the table
and something used for specifying the border */
.tbTest
{
empty-cells: show;
border-collapse:separate; /* Table and Cell borders are unique */
background-color:#DDDDDD; /* Colour of gaps between cells */
color:Black; /* Text colour */
}
.borderSpec
{
border:1px solid Navy;
}
.trTest
{
background-color:#DAD7FA;
}
.tdTest
{
padding:150px;
border-color:#7D72FC;
border-width:1px;
border-style:solid;
}
JavaScript
///////////////////////////////////////////////////////////////////////////////
// Invoke functions once the document is loaded
//
// Usage:
// Start by setting a flag to indicate that the document is not yet loaded...
// onLoad.loaded = false;
// Then register a function to set the flag when the document loads...
// onLoad(function(){ onLoad.loaded=true; });
//
function onLoad(f) {
if (onLoad.loaded)
window.setTimeout(f, 0);
else if (window.addEventListener)
window.addEventListener("load", f, false);
else if (window.attachEvent)
window.attachEvent("onload", f);
}
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// Graphics Functions
// Sometimes you have to account for scrollbar widths etc.
function getScrollBarWidth() {
var inner = document.createElement('p');
inner.style.width = "100%";
inner.style.height = "200px";
var outer = document.createElement('div');
outer.style.position = "absolute";
outer.style.top = "0px";
outer.style.left = "0px";
outer.style.visibility = "hidden";
outer.style.width = "200px";
outer.style.height = "150px";
outer.style.overflow = "hidden";
outer.appendChild(inner);
document.body.appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 == w2) w2 = outer.clientWidth;
document.body.removeChild(outer);
return (w1 - w2);
};
// Sometimes you have to account for scrollbar widths etc.
function getScrollBarHeight() {
var inner = document.createElement('p');
inner.style.height = "100%";
inner.style.width = "200px";
var outer =...