1

I have a simple flexbox layout...

.container {
    display:flex;
    flex-direction:row;
    width:100%;
}

.left {
    background:red;
}

.left img {
    padding:20px;
}

.right {
    background:green;
}
<div class="container">

<div class="left">
    <img src="https://dummyimage.com/300x200/000/fff">
</div>

<div class="right">
Right content
</div>

</div>

How do I make the right column fill the remaining space?

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
fightstarr20
  • 11,682
  • 40
  • 154
  • 278

2 Answers2

0

you can add flex: 1; to .right

.container {
    display:flex;
    flex-direction:row
    width:100%;
}

.left {
    background:red;
}

.left img {
    padding:20px;
}

.right {
  background:green;
  flex: 1;
}
<div class="container">

<div class="left">
    <img src="https://dummyimage.com/300x200/000/fff">
</div>

<div class="right">
Right content
</div>

</div>
imjared
  • 19,492
  • 4
  • 49
  • 72
0

How about flex-grow?

.container {
    display:flex;
    flex-direction:row
    width:100%;
}

.left {
    background:red;
}

.left img {
    padding:20px;
}

.right {
    background:green;
    flex-grow:1;
}
<div class="container">

<div class="left">
    <img src="https://dummyimage.com/300x200/000/fff">
</div>

<div class="right">
Right content
</div>

</div>
Félix Paradis
  • 5,165
  • 6
  • 40
  • 49