How to make 3-Column layout with fluid center without floats

前端 未结 2 1612
礼貌的吻别
礼貌的吻别 2021-01-12 05:56

I am trying to create a three column layout, with static width sidebars, and a fluid center column. I do NOT want the columns dropping when the page gets too narrow (center

相关标签:
2条回答
  • 2021-01-12 06:37

    There's nothing wrong with CSS float. You could use min-width property on the wrapper to set a minimum width.

    Here is an example:

    HTML:

    <div class="wrap">
      <div class="left">Left</div>
      <div class="right">Right</div>
      <div class="center">Center</div>
    </div>
    

    CSS:

    .wrap {
      width: 100%;
      min-width: 940px;
    }
    
    .left {
      float: left;
      width: 200px;
    }
    
    .center { margin: 0 205px; }
    
    .right {
      float: right;
      width: 200px;
    }
    

    JSBin Demo

    Update: And here is the edited Fiddle

    0 讨论(0)
  • 2021-01-12 06:54

    You can use

    display:table;
    

    example

    0 讨论(0)
提交回复
热议问题