Liquid layout with liquid left + fixed right column

前端 未结 5 785
失恋的感觉
失恋的感觉 2020-12-20 03:34

The question is pretty self explanatory. All these div elements are 100% in height I need the left div to flex, but not have it set to overflow:hidden so that I can make it\

5条回答
  •  情歌与酒
    2020-12-20 03:54

    You could achieve this layout by setting a float property to one div and using margin for the other one:

    HTML:

    Liquid layout

    CSS:

    #right {
      float: right;
      width: 450px;
    }
    
    #left {
      margin-right: 450px;
    }
    

    JSFiddle Demo

    There's no need to use table displayed elements. In fact, I really recommend to avoid using that for layout purposes.

    Note: Using table display types, may change behavior of web browser while rendering the page (browsers may consider the entire page as a table).

    According to W3C spec:

    table, inline-table, table-row-group, table-column, table-column-group, table-header-group, table-footer-group, table-row, table-cell, and table-caption

    These values cause an element to behave like a table element (subject to restrictions described in the chapter on tables).

提交回复
热议问题