Three Column Layout side columns elastic middle fixed

后端 未结 2 2093
一生所求
一生所求 2021-01-29 06:16

I was wondering if anyone knows how to have a fixed width of the centered div and have the right and left div elastic on either side of the centered div. The centered div has a

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-29 06:58

    I did it with flexbox, but can't do it with table-cell becouse side columns width depends on side column content. So my code looks like

    https://codepen.io/ArunsKas/pen/owveer

    HTML

    asdaaa asdaaaasdaaa asdaaa asdaaa

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora et nisi harum eaque quas similique esse voluptas? Expedita in vitae, vel unde deleniti hic dolores rerum. Aliquam quos quidem quae.

    ddey

    CSS

    * {
      margin: 0;
      padding: 0;
    }
    .flex {
      display: flex;
      justify-content: space-between;
    }
    .flex-children {
      width: calc((100% - 200px)/2 - 10px);
      background: red;
    }
    .flex-children-fixed {
      width: 200px;
      background: red;
    }
    

提交回复
热议问题