Struggling with calculating using calc in CSS led me to discover that my current div is showing an incorrect 100% value.
Check out this brief example:
html, body, .calender {
position: relative;
height: 100%;
overflow: hidden;
}
.appointmentsA {
background: blue;
}
.appointmentsB {
background: red;
}
.calender {
display: table;
width: 100%;
table-layout: fixed;
padding: 10px 10px 0 10px;
}
.calender .row {
display: table-cell;
padding: 0 10px;
}
.appointments {
height: 100%;
}
.appointments:before {
content: "test";
position: absolute;
top: calc(100% - 18px);
color: #fff;
}
<main class="calender">
<div class="row">
<h1 class="title">ABC</h1>
<div class="appointments appointmentsA"></div>
</div>
<div class="row">
<h1 class="title">DEF</h1>
<div class="appointments appointmentsB"></div>
</div>
</main>
The colored blocks of red and blue match the height of the container row
and its main parent element.
Is there a way to achieve the true 100% height of these colored blocks without using JavaScript? If we can accurately set the colored block height to 100%, then the ":after" element will display correctly instead of cutting off text.
Example Image: example