2 divs aligned side by side, how to make right div fill width 100%?

前端 未结 8 1068
遥遥无期
遥遥无期 2021-01-31 08:17

I\'m wondering what the best way to go about doing this is...

I have 3 divs:

  • a div#container with width=100%; tha

8条回答
  •  花落未央
    2021-01-31 08:37

    I haven't really seen a good solution in the answers here. So I'll share mine.

    Best way to do this is by using the table-cell option in CSS. One important thing to add is a 'min-width' to the element that has a pixel width.

    Example:

    Left

    CSS:

    #left {
        display: table-cell;
        min-width: 160px;
    }
    #right {
        display: table-cell;
        width: 100%;
        vertical-align: top;
    }
    

提交回复
热议问题