0

So I have div A and div B.

I need div A to scale to the exact same height as div B

The two divs sit alongside each other and I need the height of Div A to be the same as B

Here is what I have tried: CSS

.container {
  display: flex;
  flex-direction: column;

  // div a and div b
  > div {
    flex: 1;
  }
}

HTML

<div class="container">
  <div class="a">text for a</div>
  <div class="b">text for b</div>
</div>
pab
  • 971
  • 4
  • 17
  • 30
  • If your divs are side by side, then you don't need `flex-direction: column;`, – Rod911 Feb 23 '21 at 12:31
  • 1
    if you remove flex-direction:column; your divs are side by side, and, if you add more content into div b you will see that the height remains the same for both divs – Sfili_81 Feb 23 '21 at 12:59

1 Answers1

0

There are multiple ways to do this

the height property exists on a div.

Then you can use relative/ absolute heights like

Relative (both inherit from parent)

height: 3rem

Absolute (fixed)

height: 3em
Daggy1234
  • 40
  • 1
  • 9