How to Create Two Fixed Width Columns with a Flexible Column in the Center

Solution with the CSS flex property

Here, you can find out how it is possible to create a Flexbox layout with three columns, the right and left columns of which have a fixed width, whereas the column in the centre is flexible, so as it can fill the available space.

For that, use the CSS flex property.

Example of creating a flexible layout with two fixed and one flexible column:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      img {
        max-width: 100%;
      }
      #container {
        display: flex;
        max-width: 1200px;
      }
      .column.left {
        width: 230px;
        flex: 0 0 230px;
      }
      .column.right {
        width: 230px;
        flex: 0 0 230px;
        border-left: 1px solid #666;
      }
      .column.center {
        border-left: 1px solid #666;
      }
    </style>
  </head>
  <body>
    <div id="container">
      <div class="column left">
        <p>What is Lorem Ipsum?</p>
        <p>
          Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </p>
      </div>
      <div class="column center">
        <img src="http://via.placeholder.com/350x150" alt="">
      </div>
      <div class="column right">
        <p> Why do we use it?</p>
        <p>
          It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
        </p>
      </div>
    </div>
  </body>
</html>

Result

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

example

Why do we use it?

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.

So, in our example, we set the display of the container to "flex", then, specified the x-justify-content, x-align-items, and max-width properties.

Besides the width properties, we used the flex shorthand property for the left and right columns. As a value of this property we set “0 0 230px”, which means that the flex-grow is 0, flex-shrink is 0, and flex-basis is 230 px.