0

Say I have a simple grid:

.g {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.a {
  overflow: auto;
}
<div class="g">
  <div class="a">
    a<br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
    <br/> a
  </div>
  <div class="b">
    b<br/> b
    <br/> b
    <br/> b
    <br/> b
  </div>
</div>

Assume that the content in <div class="b"> is static, but the content of <div class="a"> is dynamic.

I would like to show a scrollbar in <div class="a"> if its height exceeds that of <div class="b">.

Is is possible to constrain the height of the grid to exactly fit <div class="b"> when <div class="a"> "overflows" to a greater height?

spender
  • 117,338
  • 33
  • 229
  • 351

0 Answers0