Yes, it is achievable with just html and css!
If you take a look at the following code snippet, you will see that colors are used for illustration purposes. The code provided is structured within a <div>
container but can easily be adapted to work within a <th>
/<td>
as well.
NOTE: It's important to pay attention to dimensions such as width, height of the heading boxes, sizing of outer box, font size of headings, etc., on various responsive views and different devices. Fonts may display differently based on width variations, potentially affecting your layout.
.dbox {
position: relative;
width: 200px;
height: 50px;
border: 1px solid red;
}
/* add diagonal line */
.dbox:after {
content: '';
display: block;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
z-index: -1;
background: linear-gradient(to top right, transparent calc(50% - 1px), green, transparent calc(50% + 1px) );
}
/* align boxes with headings */
.dheading_tr,
.dheading_bl{
position: absolute;
/* or wider if needed/possible */
width: 50%;
height: 50%;
overflow: hidden;
background-color: rgba(255, 255, 0, 0.2);
}
.dheading_tr {
top: 0;
right: 0;
display: flex;
justify-content: flex-end;
align-items: flex-start;
}
.dheading_bl {
bottom: 0;
left: 0;
display: flex;
justify-content: flex-start;
align-items: flex-end;
}
<div class="dbox">
<div class="dheading_tr">Top right</div>
<div class="dheading_bl">Bottom left</div>
</div>