I have a component embedded in a css-grid.
In stack blitz I have an external grid of 3 rows. The one of the rows has a min-width. How do I get it to scroll horizontally if the viewport is smaller than the min-width?
Within the middle row I have a component that itself uses a 2 column grid. The divs in the columns have a min-height.
What I am looking for is if the viewport is sized so that the entire inner component (red boxes) is not visible, the red box is scrollable.
here is a stack blitz:
https://stackblitz.com/edit/angular-q4geyk
Here is another example:
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
.content {
display: grid;
grid-template-rows: 2em 1fr 1px;
grid-gap: 0.5rem;
height: 20em;
}
.my-panel {
border: 1 green solid;
background-color: red;
padding: 0.25rem;
}
.my-component {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 0.5rem;
padding: 0.25rem;
height: 100%;
}
header {
border: green solid 1px;
padding: 4px;
}
main {
border: blue solid 1px;
padding: 1rem;
}
main div {
border: red solid 1px;
height: 100%;
}
footer {
border-bottom: black solid 1px;
}
<div class="content">
<header>
<div>Component Showcase</div>
</header>
<main>
<div>
<section class="my-component">
<div class="my-panel"> </div>
<div class="my-panel"> </div>
</section>
</div>
</main>
<footer></footer>
</div>
the_div_you_want_to_scroll
and out of the screen with no scroll. – Reversal