How to make text input box to occupy all the remaining width within parent block?

后端 未结 6 1908
星月不相逢
星月不相逢 2020-12-04 13:15

How do achieve the following:

┌────────────────────parent────────────────────┐
│ label [text-box                   ] [button] │
│ paragraph                           


        
6条回答
  •  醉酒成梦
    2020-12-04 13:56

    I don't like first answer with the "table-less" version that actually uses table-cell. Nor the second answer that uses actual tables. Nor third answer that uses hardcoded widths. Here is solution using flex. It is by far simplest:

    #parent {
      display: flex;
    }
    input {
      flex: 1;
    }
    paragraph

提交回复
热议问题