JSFiddle - React, Tailwind, and code Playground
by John Doe
HTML
<div id='table_wrapper'><table class=week><colgroup>
<col/>
<col class='mo'/>
<col class='di'/>
<col class='mi'/>
<col class='do'/>
<col class='fr'/>
<col class='sa'/>
<col class='so'/>
</colgroup>
<thead><tr><th class='kw'>KW</th><th class='mofr'>Mo</th><th class='mofr'>Di</th><th class='mofr'>Mi</th><th class='mofr'>Do</th><th class='mofr'>Fr</th><th class='we'>Sa</th><th class='we'>So</th></tr></thead><tbody><tr><th></th>
<td id='1_13_11_2017'>
</td>
<td id='1_14_11_2017'>
<div class='term'>
</div>
</td>
<td id='1_15_11_2017'>
</td>
<td id='1_16_11_2017'>
</td>
<td id='1_17_11_2017'>
</td>
<td id='1_18_11_2017'>
</td>
<td id='1_19_11_2017'>
</td></tr></tbody>
<tbody><tr><th></th>
<td id='1_13_11_2017'>
</td>
<td id='1_14_11_2017'>
<div class='term'>
</div>
</td>
<td id='1_15_11_2017'>
</td>
<td id='1_16_11_2017'>
</td>
<td id='1_17_11_2017'>
</td>
<td id='1_18_11_2017'>
</td>
<td id='1_19_11_2017'>
</td></tr></tbody>
</table>
CSS
* { box-sizing: border-box }
html
{
font-family: Calibri, sans-serif;
}
body
{
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}
#table_wrapper
{
white-space: nowrap;
/* Falls body der umgebende Container ist */
flex: 1;
overflow: auto;
}
.week
{
display: inline-table;
border-collapse: separate;
border-spacing: 0;
background-color: white;
color: black;
margin: 2px;
}
.week th,
.week td
{
border: solid #DBDBDB;
border-width: 0 thin thin 0;
width: 15vw;
height: 70px;
padding: 0px;
text-align: center;
vertical-align: middle;
font-weight: normal;
}
.week thead th
{
border-top-width: thin;
}
.week th:first-child
{
border-left-width: thin;
}
.week th
{
background: #51A2A2;
}
.week th.kw
{
background: #8A63FE;
color: #E8E8E8;
Font-weight:bold;
width: 10vw;
}
.week th.mofr
{
background: #AFAFC0;
}
.week th.we
{
background: #FF9933;
}
.week td
{
font-size: 1.75em;
position: relative;
}
.term {
width: 130px; height: 70px; border: 1px solid black;
overflow-y:auto;
display:flex; flex-direction:column;
}
.term button {
flex: 0 0 1.5em;
background:#ff8;
border:none;
white-space:pre;
width:100%; text-align:left;
overflow:hidden;
}
.term button:nth-of-type(even) {
background:#fff;
}
::-webkit-scrollbar {
-webkit-appearance: none;
}
::-webkit-scrollbar:vertical {
width: 12px;
}
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, .5);
border-radius: 10px;
border: 2px solid #ffffff;
}
::-webkit-scrollbar-track {
border-radius: 10px;
background-color: #ffffff;
}
JavaScript
document.querySelector(".term").addEventListener("click", function(evt) {
alert(evt.target.innerText);
})