<div id="scrunchyBox1" class="scrunchyBox">
<div class="sectionHead">
<div class="datedot">
<span class="day">30</span>
<span class="month">Oct</span>
</div>
<div class="sectionName">Fabertising</div>
</div>
<h2>A Headline for the Scrunchy Box</h2>
<p>This is some text that would normally be some text that the reader would want to see more of. It gets cut off here by other elements, but then other elements "scrunch" in order to reveal more of the text for a preview.</p>
<p style="text-decoration:underline;"><b><a href="https://russellbits.com">Read More</a></b></p>
</div>
:root {
--skyblue: #3AB7F4;
}
body {
background-color: #ccc;
font-size: 18px;
}
.scrunchyBox {
color: #333;
position: relative;
background-color: #fff;
width: 400px;
height: 400px;
margin: 0 auto;
padding: 0;
border: 20px solid white;
overflow: hidden;
}
.scrunchyBox > .sectionHead {
width: 400px;
height: 250px;
background-color: var(--skyblue);
padding: 0;
margin: 0 auto;
transition: all 0.5s ease-in-out;
}
.scrunchyBox .sectionName {
color: white;
font: 3em "Trebuchet MS", sans-serif;
text-align: left;
padding-top: 180px;
padding-left: 16px;
}
.scrunchyBox:hover .sectionHead {
height: 60px;
}
.scrunchyBox:hover .datedot {
transform: scale(0.60) translate(0px, -10px);
transform-origin: top right;
}
.datedot {
position: absolute;
top: 10px;
right: 10px;
background-color: rgba(0, 0, 0, 0.3);
padding: 12px;
border-radius: 60px;
width: 60px;
height: 60px;
transition: all 0.5s ease-out; /* new line */
}
.datedot > span {
font-family: "Trebuchet MS", sans-serif;
color: rgba(255, 255, 255, 1);
text-align: center;
display: block;
margin: 0;
}
.datedot > span.day {
font-size: 2.2em;
font-weight: bold;
line-height: 0.8em;
padding: 0;
}
.datedot > span.month {
font-size: 1.3em;
font-weight: normal;
text-transform: uppercase;
padding: 0;
}
.scrunchyBox > h2 {
font-family: "Trebuchet MS", sans-serif;
font-size: 1.8em;
line-height: 1em;
padding: 0;
margin: 0.4em 0 0.4em 0;
}
.scrunchyBox > p {
font-family: "Georgia", serif;
font-size: 1.4em;
padding: 0;
margin: 0.4em 0 0.4em 0;
}
.scrunchyBox > p a {
color: var(--skyblue);
}
/*
const scrunchyBox = document.getElementById('scrunchyBox1');
const children = scrunchyBox.childNodes;
console.dir(children);
const scrunchyBoxHead = children[1];
scrunchyBox.addEventListener('pointerover', (event) => {
scrunchyBoxHead.classList.remove('unscrunch');
scrunchyBoxHead.classList.add('scrunch');
});
scrunchyBox.addEventListener('pointerout', (event) => {
scrunchyBoxHead.classList.remove('scrunch');
scrunchyBoxHead.classList.add('unscrunch');
});
*/
This Pen doesn't use any external CSS resources.