Looking for a solution to address an issue with CSS grid of squares responsiveness? Consider the following CSS declarations:
nav a {
display: block;
float: left;
overflow: hidden;
padding-bottom: 25%;
width: 25%;
}
nav a p {
display: none;
}
nav a:hover p {
display: block;
}
The problem arises when overflow: hidden
is not respected upon displaying the child element, causing it to extend beyond its parent and disrupt the layout.
It seems that the percentage-based hack used for flexible squares might be causing this issue, as fixed heights work as intended.
Are there any workarounds or alternative techniques that could potentially resolve this issue?