Two divs, one fixed width, the other, the rest

前端 未结 10 1184
死守一世寂寞
死守一世寂寞 2020-11-27 11:28

I\'ve got two div containers.

Whilst one needs to be a specific width, I need to adjust it, so that, the other div takes up the rest of the space. Is there any way I

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 12:16

    See: http://jsfiddle.net/SpSjL/ (adjust the browser's width)

    HTML:

    CSS:

    .left {
        overflow: hidden;
        min-height: 50px;
        border: 2px dashed #f0f;
    }
    
    .right {
        float: right;
        width: 250px;
        min-height: 50px;
        margin-left: 10px;
        border: 2px dashed #00f;
    }
    

    You can also do it with display: table, which is usually a better approach: How can I put an input element on the same line as its label?

提交回复
热议问题